aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2020-06-19 20:25:22 +0200
committerAdrian Kummerlaender2020-06-19 20:25:22 +0200
commitbe7de4a18bdfd89fbd1fdc852d170f68cdc65ba4 (patch)
tree3a8a3df95b3d87538fdaad722415f81e1c934319
parent69ebc94b7d7061c58b03f3d2b0e4e64c4b224f50 (diff)
downloadsymlbm_playground-be7de4a18bdfd89fbd1fdc852d170f68cdc65ba4.tar
symlbm_playground-be7de4a18bdfd89fbd1fdc852d170f68cdc65ba4.tar.gz
symlbm_playground-be7de4a18bdfd89fbd1fdc852d170f68cdc65ba4.tar.bz2
symlbm_playground-be7de4a18bdfd89fbd1fdc852d170f68cdc65ba4.tar.lz
symlbm_playground-be7de4a18bdfd89fbd1fdc852d170f68cdc65ba4.tar.xz
symlbm_playground-be7de4a18bdfd89fbd1fdc852d170f68cdc65ba4.tar.zst
symlbm_playground-be7de4a18bdfd89fbd1fdc852d170f68cdc65ba4.zip
Bugfix for GL interop context initialization
Following PyOpenCL documentation This caused startup to fail when using via VirtualGL on a dual-GPU HPC node.
-rw-r--r--simulation.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/simulation.py b/simulation.py
index 535310f..5ebe9f6 100644
--- a/simulation.py
+++ b/simulation.py
@@ -153,8 +153,17 @@ class Lattice:
self.platform = cl.get_platforms()[platform]
if opengl:
- self.context = cl.Context(
- properties=[(cl.context_properties.PLATFORM, self.platform)] + get_gl_sharing_context_properties())
+ try:
+ self.context = cl.Context(
+ properties = [
+ (cl.context_properties.PLATFORM, self.platform)
+ ] + get_gl_sharing_context_properties())
+ except:
+ self.context = cl.Context(
+ properties = [
+ (cl.context_properties.PLATFORM, self.platform)
+ ] + get_gl_sharing_context_properties(),
+ devices = [ self.platform.get_devices()[0] ])
else:
self.context = cl.Context(
properties=[(cl.context_properties.PLATFORM, self.platform)])