diff options
author | Stan Seibert <stan@mtrr.org> | 2013-01-31 16:13:58 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:39 -0700 |
commit | e46056a80857860a923d6577741a1de987bd804f (patch) | |
tree | 851f18fb1ba531026943e49b0827eabed9bbfc0b | |
parent | f91c0174046bffa95c7d42ea945c47ced48ed892 (diff) | |
download | chroma-e46056a80857860a923d6577741a1de987bd804f.tar.gz chroma-e46056a80857860a923d6577741a1de987bd804f.tar.bz2 chroma-e46056a80857860a923d6577741a1de987bd804f.zip |
Do not automatically initialize pycuda before forking the camera process.
This causes weird segfaults on Macs, and is probably a source of
random crashing on other processes. Also call pygame.init()
explicitly in the new process for good measure.
-rw-r--r-- | chroma/camera.py | 4 | ||||
-rw-r--r-- | chroma/gpu/tools.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/chroma/camera.py b/chroma/camera.py index f938bd6..0d3e225 100644 --- a/chroma/camera.py +++ b/chroma/camera.py @@ -58,7 +58,7 @@ def encode_movie(dir): class Camera(multiprocessing.Process): "The camera class is used to render a Geometry object." def __init__(self, geometry, size=(800,600), device_id=None): - multiprocessing.Process.__init__(self) + super(Camera, self).__init__() self.geometry = geometry self.device_id = device_id self.size = size @@ -622,6 +622,7 @@ class Camera(multiprocessing.Process): return def run(self): + pygame.init() self.window = pygame.display.set_mode(self.size) self.screen = pygame.Surface(self.size, pygame.SRCALPHA) pygame.display.set_caption('') @@ -825,3 +826,4 @@ def view(obj, size=(800,600), **camera_kwargs): geometry = create_geometry_from_obj(obj) camera = Camera(geometry, size, **camera_kwargs) camera.start() + camera.join() diff --git a/chroma/gpu/tools.py b/chroma/gpu/tools.py index 98c7e6a..8bf5d81 100644 --- a/chroma/gpu/tools.py +++ b/chroma/gpu/tools.py @@ -8,8 +8,6 @@ from pycuda import gpuarray as ga from chroma.cuda import srcdir -cuda.init() - # standard nvcc options cuda_options = ('--use_fast_math',)#, '--ptxas-options=-v'] |