{"push_id":2369269178,"size":1,"distinct_size":1,"ref":"refs/heads/patch-1","head":"97a4277577adac1955e33b05887984f79420a9d5","before":"7b6ad00370e50c2a5a6479383984cb7a0e9333f1","commits":[{"sha":"97a4277577adac1955e33b05887984f79420a9d5","author":{"name":"zemanj","email":"a73c2ff785b1ee875eb7d3c3a7cf1f3ef8327efe@googlemail.com"},"message":"Fixed MPI fork() warning when importing MDAnalysis after MPI_Init() call\n\nSolved problem:\r\n---------------\r\nWhen used in an MPI environment, importing MDAnalysis may trigger an MPI\r\nwarning because importing the uuid module in MDAnalysis.core.universe\r\ntriggers a call to os.fork(). This happens if MPI_Init() has been called\r\nprior to importing MDAnalysis.\r\n\r\nWhy this was fixed:\r\n-------------------\r\nFor the user, it is completely unclear where and why the MPI warning was\r\ntriggered and whether that is of any concern.\r\n\r\nHow to reproduce:\r\n-----------------\r\nWith OpenMPI (version should be irrelevant, tested on 1.10.2) and Python < 3.7, executing\r\nthe command\r\n  echo \"import mpi4py.MPI, MDAnalysis\" | mpirun --mca mpi_warn_on_fork 1 -n 1 python -\r\nyields the following output:\r\n\r\n\"\"\"\r\nAn MPI process has executed an operation involving a call to the\r\n\"fork()\" system call to create a child process.  Open MPI is currently\r\noperating in a condition that could result in memory corruption or\r\nother system errors; your MPI job may hang, crash, or produce silent\r\ndata corruption.  The use of fork() (or system() or other calls that\r\ncreate child processes) is strongly discouraged.  \r\n\r\nThe process that invoked fork was:\r\n\r\n  Local host:          <hostname> (PID <pid>)\r\n  MPI_COMM_WORLD rank: 0\r\n\r\nIf you are *absolutely sure* that your application will successfully\r\nand correctly survive a call to fork(), you may disable this warning\r\nby setting the mpi_warn_on_fork MCA parameter to 0.\r\n\"\"\"\r\n\r\nIf you cannot reproduce this warning, it is probably due to your Python\r\ninstallation using an implementation of fork() that is named differently and,\r\nthus, is not recognized by mpirun (can be checked for example with gdb).\r\n\r\nExplanation:\r\n------------\r\nThe problem is actually caused by the uuid module, which is imported in\r\nMDAnalysis.core.universe and triggers a call to os.fork() by calling a couple\r\nof methods from the ctypes module which in turn use the subprocess module\r\n(that's where os.fork() actually gets called).\r\nThis means that the real problem is not due to MDAnalysis itself, but it also\r\nmeans that it will probably never be fixed for older Python versions.\r\nIn Python 3.7, the problem with the uuid module is solved. (see\r\nhttps://bugs.python.org/issue11063 for further information)\r\nLuckily, for Python < 3.7, the uuid module works perfectly fine with\r\nos.fork() disabled during its import.\r\nA clean fix is therefore simply to disable os.fork() prior to importing the\r\nuuid module in MDAnalysis.core.universe and to re-enable it afterwards (for\r\nPython < 3.7 only).","distinct":true,"url":"https://api.github.com/repos/zemanj/mdanalysis/commits/97a4277577adac1955e33b05887984f79420a9d5"}]}
{"actor":{"display_login":"zemanj"}}