File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
gpu-test-framework/src/main/java/com/hellblazer/gpu/test/support Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -117,12 +117,26 @@ private boolean detectCIEnvironment() {
117117 }
118118
119119 private void detectBackendSupport () {
120- // OpenCL detection
120+ // OpenCL detection - handle already-initialized state correctly
121+ // Note: We do NOT destroy CL after detection because subsequent code may need it
121122 try {
122- CL .create ();
123+ try {
124+ CL .create ();
125+ log .debug ("OpenCL initialized successfully" );
126+ } catch (IllegalStateException e ) {
127+ // "OpenCL has already been created" means it's available
128+ if (e .getMessage () != null && e .getMessage ().contains ("already been created" )) {
129+ log .debug ("OpenCL already initialized - treating as available" );
130+ } else {
131+ throw e ; // Re-throw other IllegalStateExceptions
132+ }
133+ }
134+
135+ // OpenCL is available (either we created it or it was already created)
123136 backendSupport .put (Backend .OPENCL , ciEnvironment ? SupportLevel .MOCK : SupportLevel .FULL );
124137 } catch (Throwable t ) {
125- backendSupport .put (Backend .OPENCL ,
138+ log .debug ("OpenCL not available: {}" , t .getMessage ());
139+ backendSupport .put (Backend .OPENCL ,
126140 ciEnvironment ? SupportLevel .MOCK : SupportLevel .NOT_AVAILABLE );
127141 }
128142
You can’t perform that action at this time.
0 commit comments