{"action":"created","issue":{"url":"https://api.github.com/repos/pandegroup/openmm/issues/1886","repository_url":"https://api.github.com/repos/pandegroup/openmm","labels_url":"https://api.github.com/repos/pandegroup/openmm/issues/1886/labels{/name}","comments_url":"https://api.github.com/repos/pandegroup/openmm/issues/1886/comments","events_url":"https://api.github.com/repos/pandegroup/openmm/issues/1886/events","html_url":"https://github.com/pandegroup/openmm/issues/1886","id":254999909,"number":1886,"title":"OpenCL invalid context error when running in separate Python process on Mac","user":{"login":"tristanc1","id":7909352,"avatar_url":"https://avatars3.githubusercontent.com/u/7909352?v=4","gravatar_id":"","url":"https://api.github.com/users/tristanc1","html_url":"https://github.com/tristanc1","followers_url":"https://api.github.com/users/tristanc1/followers","following_url":"https://api.github.com/users/tristanc1/following{/other_user}","gists_url":"https://api.github.com/users/tristanc1/gists{/gist_id}","starred_url":"https://api.github.com/users/tristanc1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tristanc1/subscriptions","organizations_url":"https://api.github.com/users/tristanc1/orgs","repos_url":"https://api.github.com/users/tristanc1/repos","events_url":"https://api.github.com/users/tristanc1/events{/privacy}","received_events_url":"https://api.github.com/users/tristanc1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-09-04T10:27:01Z","updated_at":"2017-09-04T17:39:47Z","closed_at":null,"author_association":"NONE","body":"I've been putting together an improved interactive MD implementation that uses Python's multiprocessing module to start the simulation in a separate process and keep it out of the graphics loop. This is working really well in Linux, but on my 2016 MacBook Air on the OpenCL platform I get the error:\r\n\r\n```\r\nTraceback (most recent call last):\r\nFile \"/Users/tic20/Library/Application Support/ChimeraX/0.1/site-packages/chimerax/isolde/openmm/sim_thread.py\", line 429, in __init__\r\nself.sim = sh.create_sim()\r\nFile \"/Users/tic20/Library/Application Support/ChimeraX/0.1/site-packages/chimerax/isolde/openmm/sim_handler.py\", line 547, in create_sim\r\nself.topology, self.system, self.integrator, self.platform)\r\nFile \"/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/simtk/openmm/app/simulation.py\", line 103, in __init__\r\nself.context = mm.Context(self.system, self.integrator, platform)\r\nFile \"/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/simtk/openmm/openmm.py\", line 6481, in __init__\r\nthis = _openmm.new_Context(*args)\r\nException: Error initializing context: Retain Object (-34)\r\n```\r\n\r\n... which I believe corresponds to OpenCL's CL_INVALID_CONTEXT\r\n\r\nNot really sure where to go from here in debugging. Some extra details: \r\n\r\n- I'm using the \"fork\" multiprocessing approach\r\n- Running OpenMM's `benchmark.py --platform=OpenCL` from the command line using the same Python as in the GUI passes the first three tests, but fails on amoeba:\r\n\r\n```\r\nTest: amoebagk (epsilon=1e-05)\r\nStep Size: 2 fs\r\nTraceback (most recent call last):\r\n  File \"/usr/local/openmm/examples/benchmark.py\", line 143, in <module>\r\n    runOneTest(test, options)\r\n  File \"/usr/local/openmm/examples/benchmark.py\", line 97, in runOneTest\r\n    context = mm.Context(system, integ, platform, properties)\r\n  File \"/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/simtk/openmm/openmm.py\", line 6481, in __init__\r\n    this = _openmm.new_Context(*args)\r\nException: Specified a Platform for a Context which does not support all required kernels\r\n```\r\n\r\n... which isn't a problem for me, since my use case corresponds most closely to the gbsa benchmark.\r\n\r\nEDIT: Oh, and the CPU platform runs fine in the threaded implementation."},"comment":{"url":"https://api.github.com/repos/pandegroup/openmm/issues/comments/327007102","html_url":"https://github.com/pandegroup/openmm/issues/1886#issuecomment-327007102","issue_url":"https://api.github.com/repos/pandegroup/openmm/issues/1886","id":327007102,"user":{"login":"tristanc1","id":7909352,"avatar_url":"https://avatars3.githubusercontent.com/u/7909352?v=4","gravatar_id":"","url":"https://api.github.com/users/tristanc1","html_url":"https://github.com/tristanc1","followers_url":"https://api.github.com/users/tristanc1/followers","following_url":"https://api.github.com/users/tristanc1/following{/other_user}","gists_url":"https://api.github.com/users/tristanc1/gists{/gist_id}","starred_url":"https://api.github.com/users/tristanc1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tristanc1/subscriptions","organizations_url":"https://api.github.com/users/tristanc1/orgs","repos_url":"https://api.github.com/users/tristanc1/repos","events_url":"https://api.github.com/users/tristanc1/events{/privacy}","received_events_url":"https://api.github.com/users/tristanc1/received_events","type":"User","site_admin":false},"created_at":"2017-09-04T17:39:47Z","updated_at":"2017-09-04T17:39:47Z","author_association":"NONE","body":"The upshot is that in these circumstances the Context is treated as invalid by everything downstream, and the reasons why are buried away in the closed-source Apple OpenCL implementation. Seems I'm going to have to find a different/better approach if I want a cross-platform threaded implementation... Feel free to close this - I'd be quite surprised if anyone else were to run into the same issue."}}
{"actor":{"display_login":"tristanc1"}}