{"action":"created","issue":{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/1608","labels_url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/1608/labels{/name}","comments_url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/1608/comments","events_url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/1608/events","html_url":"https://github.com/UV-CDAT/uvcdat/issues/1608","id":111270333,"number":1608,"title":"MPI builds and Python multiprocessing","user":{"login":"painter1","id":2799665,"avatar_url":"https://avatars.githubusercontent.com/u/2799665?v=3","gravatar_id":"","url":"https://api.github.com/users/painter1","html_url":"https://github.com/painter1","followers_url":"https://api.github.com/users/painter1/followers","following_url":"https://api.github.com/users/painter1/following{/other_user}","gists_url":"https://api.github.com/users/painter1/gists{/gist_id}","starred_url":"https://api.github.com/users/painter1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/painter1/subscriptions","organizations_url":"https://api.github.com/users/painter1/orgs","repos_url":"https://api.github.com/users/painter1/repos","events_url":"https://api.github.com/users/painter1/events{/privacy}","received_events_url":"https://api.github.com/users/painter1/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/labels/High%20Priority","name":"High Priority","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/milestones/14","html_url":"https://github.com/UV-CDAT/uvcdat/milestones/2.4.1","labels_url":"https://api.github.com/repos/UV-CDAT/uvcdat/milestones/14/labels","id":1483284,"number":14,"title":"2.4.1","description":"uvcmetrics climo speed boost","creator":{"login":"doutriaux1","id":2781425,"avatar_url":"https://avatars.githubusercontent.com/u/2781425?v=3","gravatar_id":"","url":"https://api.github.com/users/doutriaux1","html_url":"https://github.com/doutriaux1","followers_url":"https://api.github.com/users/doutriaux1/followers","following_url":"https://api.github.com/users/doutriaux1/following{/other_user}","gists_url":"https://api.github.com/users/doutriaux1/gists{/gist_id}","starred_url":"https://api.github.com/users/doutriaux1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doutriaux1/subscriptions","organizations_url":"https://api.github.com/users/doutriaux1/orgs","repos_url":"https://api.github.com/users/doutriaux1/repos","events_url":"https://api.github.com/users/doutriaux1/events{/privacy}","received_events_url":"https://api.github.com/users/doutriaux1/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2016-01-04T19:35:58Z","updated_at":"2016-01-20T00:10:12Z","due_on":"2016-02-15T08:00:00Z","closed_at":null},"comments":15,"created_at":"2015-10-13T21:02:13Z","updated_at":"2016-01-20T22:07:24Z","closed_at":null,"body":"It should be our goal for UV-CDAT to allow the user to use any standard Python module.  It is a bug if you have to use one build of UV-CDAT for one module, and another build for another module.\r\n\r\nI want to use the multiprocessing module.  This is part of the Python standard, so it is available in every build of UV-CDAT.  Sometimes, but not at the same time, I want to use the py4mpi module.  This isn't part of the Python standard, but is widely used, and can optionally be built into UV-CDAT\r\n\r\nThe problem is that if we build a UV-CDAT with MPI support, then MPI is always running whether you need it or not.  This is not a problem on a Macintosh.  But on some platforms, OpenMPI (the version we build into UV-CDAT) forbids fork operations,  In Python 2.7 and below, the multiprocessing module creates processes by forking them (Python 3.x allows other, slower, methods).  So it won't work!\r\n\r\nOn Rhea.ccs.ornl.gov, I built a UV-CDAT with MPI support, made sure that no Python code imports mpi4py (by deleting it from site-packages/), and then tried to run a script with the multiprocessing module.  I got a warning:\r\n    An 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\n    operating in a condition that could result in memory corruption or\r\n    other system errors; your MPI job may hang, crash, or produce silent\r\n    data corruption.  The use of fork() (or system() or other calls that\r\n    create child processes) is strongly discouraged. \r\nand when I ran anyway, my code failed sometimes, always during file open operations.\r\n\r\nAlmost surely, the explanation is that some C code someplace in UV-CDAT is calling MPI_Init.  That's necessary if you are using py4mpi, but deadly (on Rhea) if you are using the multiprocessing module.\r\n\r\nIf the user never imports py4mpi, then we should not call MPI_Init.  If the user imports both py4mpi and multiprocessing, then we should call MPI_Init, and issue a warning."},"comment":{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/comments/173377263","html_url":"https://github.com/UV-CDAT/uvcdat/issues/1608#issuecomment-173377263","issue_url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/1608","id":173377263,"user":{"login":"dnadeau4","id":6933634,"avatar_url":"https://avatars.githubusercontent.com/u/6933634?v=3","gravatar_id":"","url":"https://api.github.com/users/dnadeau4","html_url":"https://github.com/dnadeau4","followers_url":"https://api.github.com/users/dnadeau4/followers","following_url":"https://api.github.com/users/dnadeau4/following{/other_user}","gists_url":"https://api.github.com/users/dnadeau4/gists{/gist_id}","starred_url":"https://api.github.com/users/dnadeau4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnadeau4/subscriptions","organizations_url":"https://api.github.com/users/dnadeau4/orgs","repos_url":"https://api.github.com/users/dnadeau4/repos","events_url":"https://api.github.com/users/dnadeau4/events{/privacy}","received_events_url":"https://api.github.com/users/dnadeau4/received_events","type":"User","site_admin":false},"created_at":"2016-01-20T22:07:24Z","updated_at":"2016-01-20T22:07:24Z","body":"We did and Jeff is aware of it.  MPI is not working well with multiprocessing python module."}}