CLIJ2 BETA testing - call for testers 👷

Hey Rita,

bad news, I couldn’t figure out how to translate the tubeness measurement to CLIJ. Regarding the Hessian: A collaborators project has these filters. I’ll ask them if they are willing to share. Stay tuned!

Cheers,
Robert

2 Likes

Hello!

I’ve been writing a macro that uses the CLIJx_subtractBackground3D and Ext.CLIJ2_addImages, and after updating I now get this error everytime i try to run the macro with those functions.

The error appears to be similar, here’s another macro I wrote to test it the use of these two functions separately

close("*");
run("T1 Head (2.4M, 16-bits)");
input = getTitle();
getDimensions(width, height, channels, slices, frames);

blurred = "Blurred";
blurred_mask = "blurmask";
input_mask = "inmask";
FINAL = "final image";


run("CLIJ2 Macro Extensions", "cl_device="); //initiate clij
Ext.CLIJ2_clear();
Ext.CLIJ2_push(input);
Ext.CLIJx_subtractBackground3D(input, input_noback, 0.2, 0.2, 0.2);

Ext.CLIJ2_mean3DBox(input, blurred, 3, 3, 3);
Ext.CLIJ2_thresholdHuang(blurred, blurred_mask);
Ext.CLIJ2_thresholdHuang(input, input_mask);
Ext.CLIJ2_addImages(input_mask, blurred_mask, FINAL);


Ext.CLIJ2_pull(FINAL);

And here’s the console error I get

Error when trying to create kernel add_images_weighted_3d
net.haesleinhuepf.clij.clearcl.exceptions.OpenCLException: OpenCL error: -45 -> CL_INVALID_PROGRAM_EXECUTABLE
	at net.haesleinhuepf.clij.clearcl.backend.BackendUtils.checkOpenCLErrorCode(BackendUtils.java:352)
	at net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL.lambda$getKernelPeerPointer$19(ClearCLBackendJOCL.java:601)
	at net.haesleinhuepf.clij.clearcl.backend.BackendUtils.checkExceptions(BackendUtils.java:156)
	at net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL.getKernelPeerPointer(ClearCLBackendJOCL.java:593)
	at net.haesleinhuepf.clij.clearcl.ClearCLCompiledProgram.createKernel(ClearCLCompiledProgram.java:137)
	at net.haesleinhuepf.clij.clearcl.ClearCLProgram.createKernel(ClearCLProgram.java:685)
	at net.haesleinhuepf.clij.clearcl.util.CLKernelExecutor.getKernel(CLKernelExecutor.java:353)
	at net.haesleinhuepf.clij.clearcl.util.CLKernelExecutor.enqueue(CLKernelExecutor.java:229)
	at net.haesleinhuepf.clij2.CLIJ2.lambda$executeSubsequently$0(CLIJ2.java:425)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:97)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:28)
	at net.haesleinhuepf.clij2.CLIJ2.executeSubsequently(CLIJ2.java:416)
	at net.haesleinhuepf.clij2.CLIJ2.executeSubsequently(CLIJ2.java:403)
	at net.haesleinhuepf.clij2.CLIJ2.executeSubsequently(CLIJ2.java:398)
	at net.haesleinhuepf.clij2.CLIJ2.execute(CLIJ2.java:383)
	at net.haesleinhuepf.clij2.plugins.AddImagesWeighted.addImagesWeighted(AddImagesWeighted.java:47)
	at net.haesleinhuepf.clij2.plugins.AddImages.addImages(AddImages.java:28)
	at net.haesleinhuepf.clij2.CLIJ2Ops.addImages(CLIJ2Ops.java:2294)
	at net.haesleinhuepf.clij2.plugins.AddImages.executeCL(AddImages.java:24)
	at net.haesleinhuepf.clij.macro.CLIJHandler.lambda$handleExtension$0(CLIJHandler.java:163)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:97)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:28)
	at net.haesleinhuepf.clij.macro.CLIJHandler.handleExtension(CLIJHandler.java:53)
	at ij.macro.ExtensionDescriptor.dispatch(ExtensionDescriptor.java:288)
	at ij.macro.Functions.doExt(Functions.java:4787)
	at ij.macro.Functions.getStringFunction(Functions.java:276)
	at ij.macro.Interpreter.getStringTerm(Interpreter.java:1407)
	at ij.macro.Interpreter.getString(Interpreter.java:1385)
	at ij.macro.Interpreter.doStatement(Interpreter.java:329)
	at ij.macro.Interpreter.doStatements(Interpreter.java:261)
	at ij.macro.Interpreter.run(Interpreter.java:157)
	at ij.macro.Interpreter.run(Interpreter.java:91)
	at ij.macro.Interpreter.run(Interpreter.java:102)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:161)
	at ij.IJ.runMacro(IJ.java:148)
	at ij.IJ.runMacro(IJ.java:137)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1148)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1144)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1095)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1144)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:145)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
java.lang.NullPointerException
	at net.haesleinhuepf.clij2.CLIJ2.execute(CLIJ2.java:384)
	at net.haesleinhuepf.clij2.plugins.AddImagesWeighted.addImagesWeighted(AddImagesWeighted.java:47)
	at net.haesleinhuepf.clij2.plugins.AddImages.addImages(AddImages.java:28)
	at net.haesleinhuepf.clij2.CLIJ2Ops.addImages(CLIJ2Ops.java:2294)
	at net.haesleinhuepf.clij2.plugins.AddImages.executeCL(AddImages.java:24)
	at net.haesleinhuepf.clij.macro.CLIJHandler.lambda$handleExtension$0(CLIJHandler.java:163)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:97)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:28)
	at net.haesleinhuepf.clij.macro.CLIJHandler.handleExtension(CLIJHandler.java:53)
	at ij.macro.ExtensionDescriptor.dispatch(ExtensionDescriptor.java:288)
	at ij.macro.Functions.doExt(Functions.java:4787)
	at ij.macro.Functions.getStringFunction(Functions.java:276)
	at ij.macro.Interpreter.getStringTerm(Interpreter.java:1407)
	at ij.macro.Interpreter.getString(Interpreter.java:1385)
	at ij.macro.Interpreter.doStatement(Interpreter.java:329)
	at ij.macro.Interpreter.doStatements(Interpreter.java:261)
	at ij.macro.Interpreter.run(Interpreter.java:157)
	at ij.macro.Interpreter.run(Interpreter.java:91)
	at ij.macro.Interpreter.run(Interpreter.java:102)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:161)
	at ij.IJ.runMacro(IJ.java:148)
	at ij.IJ.runMacro(IJ.java:137)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1148)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1144)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1095)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1144)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:145)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)


Any clue on what’s happening to get this error?

Best wishes,
Rita

Hi @Rita,

sorry for the inconvenience. I obviously introduced that bug in the last release on Monday. Thanks for reporting it! If you update your Fiji, it shoud be gone and your script should work.

Let me know if it helps!

Cheers,
Robert

1 Like

Hello @haesleinhuepf,

Lately I’m getting a lot of CLIJ2/OpenCL errors, with multiple operations actually.
For instance, the simple macro

run("CLIJ2 Macro Extensions", "cl_device=");
run("T1 Head (2.4M, 16-bits)");
image1 = getTitle();

radius = 2;

// compute 3D mean
Ext.CLIJ2_push(image1);
Ext.CLIJ2_mean3DBox(image1, image2, radius, radius, radius);
Ext.CLIJ2_pull(image2);

// compute 3D median
Ext.CLIJ2_push(image1);
Ext.CLIJ2_median3DBox(image1, image3, radius, radius, radius);
Ext.CLIJ2_pull(image3);

Ext.CLIJ2_clear();

works fine for radius <= 2, but for radius >=3 it throws these exceptions in the console:

net.haesleinhuepf.clij.clearcl.exceptions.OpenCLException: OpenCL error: -36 -> CL_INVALID_COMMAND_QUEUE
	at net.haesleinhuepf.clij.clearcl.backend.BackendUtils.checkOpenCLError(BackendUtils.java:346)
	at net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL.lambda$waitQueueToFinish$46(ClearCLBackendJOCL.java:1208)
	at net.haesleinhuepf.clij.clearcl.backend.BackendUtils.checkExceptions(BackendUtils.java:171)
	at net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL.waitQueueToFinish(ClearCLBackendJOCL.java:1207)
	at net.haesleinhuepf.clij.clearcl.ClearCLQueue.waitToFinish(ClearCLQueue.java:56)
	at net.haesleinhuepf.clij.clearcl.ClearCLKernel.lambda$run$0(ClearCLKernel.java:497)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:97)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:64)
	at net.haesleinhuepf.clij.clearcl.ClearCLKernel.run(ClearCLKernel.java:477)
	at net.haesleinhuepf.clij.clearcl.ClearCLKernel.run(ClearCLKernel.java:459)
	at net.haesleinhuepf.clij.clearcl.util.CLKernelExecutor.lambda$enqueue$1(CLKernelExecutor.java:267)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:97)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:28)
	at net.haesleinhuepf.clij.clearcl.util.CLKernelExecutor.enqueue(CLKernelExecutor.java:266)
	at net.haesleinhuepf.clij2.CLIJ2.lambda$executeSubsequently$0(CLIJ2.java:431)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:97)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:28)
	at net.haesleinhuepf.clij2.CLIJ2.executeSubsequently(CLIJ2.java:422)
	at net.haesleinhuepf.clij2.CLIJ2.executeSubsequently(CLIJ2.java:409)
	at net.haesleinhuepf.clij2.CLIJ2.executeSubsequently(CLIJ2.java:404)
	at net.haesleinhuepf.clij2.CLIJ2.execute(CLIJ2.java:389)
	at net.haesleinhuepf.clij2.plugins.Median3DBox.median3DBox(Median3DBox.java:57)
	at net.haesleinhuepf.clij2.CLIJ2Ops.median3DBox(CLIJ2Ops.java:3992)
	at net.haesleinhuepf.clij2.plugins.Median3DBox.executeCL(Median3DBox.java:37)
	at net.haesleinhuepf.clij.macro.CLIJHandler.lambda$handleExtension$0(CLIJHandler.java:163)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:97)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:28)
	at net.haesleinhuepf.clij.macro.CLIJHandler.handleExtension(CLIJHandler.java:53)
	at ij.macro.ExtensionDescriptor.dispatch(ExtensionDescriptor.java:288)
	at ij.macro.Functions.doExt(Functions.java:4787)
	at ij.macro.Functions.getStringFunction(Functions.java:276)
	at ij.macro.Interpreter.getStringTerm(Interpreter.java:1407)
	at ij.macro.Interpreter.getString(Interpreter.java:1385)
	at ij.macro.Interpreter.doStatement(Interpreter.java:329)
	at ij.macro.Interpreter.doStatements(Interpreter.java:261)
	at ij.macro.Interpreter.run(Interpreter.java:157)
	at ij.macro.Interpreter.run(Interpreter.java:91)
	at ij.macro.Interpreter.run(Interpreter.java:102)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:161)
	at ij.IJ.runMacro(IJ.java:148)
	at ij.IJ.runMacro(IJ.java:137)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1148)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1144)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1095)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1144)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:145)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
net.haesleinhuepf.clij.clearcl.exceptions.OpenCLException: OpenCL error: -5 -> CL_OUT_OF_RESOURCES
	at net.haesleinhuepf.clij.clearcl.backend.BackendUtils.checkOpenCLError(BackendUtils.java:346)
	at net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL.lambda$enqueueReadFromBuffer$24(ClearCLBackendJOCL.java:791)
	at net.haesleinhuepf.clij.clearcl.backend.BackendUtils.checkExceptions(BackendUtils.java:171)
	at net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL.enqueueReadFromBuffer(ClearCLBackendJOCL.java:790)
	at net.haesleinhuepf.clij.clearcl.ClearCLBuffer.writeTo(ClearCLBuffer.java:400)
	at net.haesleinhuepf.clij.clearcl.ClearCLBuffer.writeTo(ClearCLBuffer.java:366)
	at net.haesleinhuepf.clij.converters.implementations.ClearCLBufferToImagePlusConverter.convert(ClearCLBufferToImagePlusConverter.java:61)
	at net.haesleinhuepf.clij.converters.implementations.ClearCLBufferToImagePlusConverter.convert(ClearCLBufferToImagePlusConverter.java:26)
	at net.haesleinhuepf.clij.CLIJ.convert(CLIJ.java:469)
	at net.haesleinhuepf.clij.CLIJ.show(CLIJ.java:352)
	at net.haesleinhuepf.clij.macro.CLIJHandler.pullFromGPU(CLIJHandler.java:250)
	at net.haesleinhuepf.clij2.plugins.Pull.executeCL(Pull.java:24)
	at net.haesleinhuepf.clij.macro.CLIJHandler.lambda$handleExtension$0(CLIJHandler.java:163)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:97)
	at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:28)
	at net.haesleinhuepf.clij.macro.CLIJHandler.handleExtension(CLIJHandler.java:53)
	at ij.macro.ExtensionDescriptor.dispatch(ExtensionDescriptor.java:288)
	at ij.macro.Functions.doExt(Functions.java:4787)
	at ij.macro.Functions.getStringFunction(Functions.java:276)
	at ij.macro.Interpreter.getStringTerm(Interpreter.java:1407)
	at ij.macro.Interpreter.getString(Interpreter.java:1385)
	at ij.macro.Interpreter.doStatement(Interpreter.java:329)
	at ij.macro.Interpreter.doStatements(Interpreter.java:261)
	at ij.macro.Interpreter.run(Interpreter.java:157)
	at ij.macro.Interpreter.run(Interpreter.java:91)
	at ij.macro.Interpreter.run(Interpreter.java:102)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:161)
	at ij.IJ.runMacro(IJ.java:148)
	at ij.IJ.runMacro(IJ.java:137)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1148)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1144)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1095)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1144)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:145)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Clearing 
Releasing buffer CLIJ2_mean3DBox_result3
Releasing buffer CLIJ2_median3DBox_result4
Releasing buffer t1-head.tif

After that error I have to restart Fiji to get CLIJ2 back on its feet.
I’m using an NVidia GeForce GTX 850M card with 2 GB memory, OpenCL version: 1.2.

Any clue?

Some observations that may or may not be useful:

  • It should not be a memory issue, since the image is only a few tens of MB. That said, after first downsamplingthe image it works OK with radius=3, but crashes again at radius=4.
  • I have very similar issues with Ext.CLIJ2_medianSliceBySliceBox, and possibly some other CLIJ2 commands.

Thanks for the support!
Bram

1 Like

Hey @bramvdbroek,

would you mind trying to add an Ext.CLIJ2_clear() right after initialization of the CLIJ2 extensions? explanation

Furthermore, you’re pushing image1 twice. That will technically work but might take unnecessary time.

Downsampling? The code doesn’t do downsampling. Are there maybe other scripts running as well? :upside_down_face:

Let me know if that helps!

Cheers,
Robert

1 Like

5:19, you were up early, @haesleinhuepf! Such devotion…

Unfortunately the Ext.CLIJ2_clear() statement right after initialization of the CLIJ2 extensions doesn’t help. I still get
net.haesleinhuepf.clij.clearcl.exceptions.OpenCLException: OpenCL error: -36 -> CL_INVALID_COMMAND_QUEUE, sometimes followed by
net.haesleinhuepf.clij.clearcl.exceptions.OpenCLException: OpenCL error: -5 -> CL_OUT_OF_RESOURCES..

I actually forgot to tell you that Ext.CLIJ2_mean3DBox works well, but it crashes on Ext.CLIJ2_median3DBox (or anyother CLIJ2 median command).

And you are right, the downsampling I added only later. (By the way, the console also says downsample3D is deprecated? It doesn’t look like that in the docs). Here is the complete code, without pushing image1 twice:

run("CLIJ2 Macro Extensions", "cl_device=");
Ext.CLIJ2_clear();

run("T1 Head (2.4M, 16-bits)");
image1 = getTitle();
Ext.CLIJ2_push(image1);

radius = 2;

// compute 3D mean
Ext.CLIJ2_mean3DBox(image1, image2, radius, radius, radius);
Ext.CLIJ2_pull(image2);

// compute 3D median
Ext.CLIJ2_downsample3D(image1, image3, 0.5, 0.5, 0.5);
Ext.CLIJ2_median3DBox(image3, image4, radius, radius, radius);
Ext.CLIJ2_pull(image4);

Ext.CLIJ2_clear();

Which automatically brings me to another point: In analysis workflows it often occurs that you want to execute a statement conditionally, e.g. background subtract, filter, etc, based on the user’s input.
For this particular macro, if you want to run it with and without downsampling, besides outcommenting the downsampling you also need to rename the input image in Ext.CLIJ2_median3DBox to image2, because image3 doesn’t exist. Therefore, one cannot easily have a boolean user input downsampling and a statement if(downsampling == true) Ext.CLIJ2_downsample3D(...).

I guess this is a consequence of the (otherwise great) ‘byRef Image’ method. In the past you had made some CLIJ2 commands ‘in place’, but these seem to have been phased out.

Now I was thinking, would it in principle be possible for CL(IJ) to execute commands ‘inplace’ if the destination image variable is set the same as the input image? (e.g. by recognizing that, clearing the input image memory and then renaming the output reference to the input reference.) Or is that inherently very difficult ‘under the CL hood’? It would definitely solve many issues.

Thanks again!
Bram

Ok, then let’s check your hardware :wink:

  • Could you please try to execute the workflow on your Intel HD GPU? I assume your laptop has one:
run("CLIJ2 Macro Extensions", "cl_device=HD");
run("CLIJ2 Macro Extensions", "cl_device=");
Ext.CLIJ_clInfo();

No problem, as images are variables:

Ext.CLIJ2_push(input);

if (user_input) {
	Ext.CLIJ2_gaussianBlur2D(input, output, 1, 1);
} else {
	output = input;
}

Ext.CLIJ2_pull(output);

Some “apparent inplace” methods still exist in CLIJx:

run("CLIJ2 Macro Extensions", "cl_device=");
Ext.CLIJ2_help("inplace");

Having a way for doing what you want in a more systematic may end up on the roadmap for clEsperanto as python users demand it. Eventually code will likely look like this:

image = gaussianBlur(image, 2);

Until they are generally availabe, some details need to be streamlined under the hood. In the meantime, you can implement such methods yourself if you like:

function gaussianBlur(input, sigma) {
	Ext.CLIJ2_gaussianBlur2D(input, output, sigma, sigma);
	return output;	
}

Intransparent “renaming” might confuse users. However, I see where you want to go and can promise that we’re moving in the same direction :wink:

Let me know if the driver thingy solves your GPU issue.

Cheers,
Robert

1 Like

Thanks for all your answers, @haesleinhuepf!
Indeed, you mention nice workarounds that I will certainly employ (and also feel a bit ashamed that I didn’t come up with those myself).

Now about the CLIJ issue.
I gave it a try on my work computer, which has a Quadro M2000, running on Windows 7, with updated NVIDIA drivers.
Same error!
Actually worse. The first time I tried the macro, the video card’s output to the screen stopped completely. I had to go in via remote desktop from another computer to find out that Fiji had crashed. The second time the screen was momentarily flickering before giving me net.haesleinhuepf.clij.clearcl.exceptions.OpenCLException: OpenCL error: -36 -> CL_INVALID_COMMAND_QUEUE and net.haesleinhuepf.clij.clearcl.exceptions.OpenCLException: OpenCL error: -5 -> CL_OUT_OF_RESOURCES. .

Here is the CLInfo output:

Available CL backends:
  * net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@7dfec0a2
    Functional backend:net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@262b7ecf
    Best backend:net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@4b4360bc
Used CL backend: net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@46518521
ClearCL: ClearCLBase [mClearCLBackendInterface=net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@46518521, mPeerPointer=null]
  Number of platforms:1
  [0] NVIDIA CUDA
     Number of devices: 1
     Available devices: 
     [0] Quadro M2000 
        NumberOfComputeUnits: 6 
        Clock frequency: 1162 
        Version: 1.2 
        Extensions: cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_d3d9_sharing cl_nv_d3d10_sharing cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_copy_opts cl_khr_gl_event cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_kernel_attribute_nv 
        GlobalMemorySizeInBytes: 4294967296 
        LocalMemorySizeInBytes: 49152 
        MaxMemoryAllocationSizeInBytes: 1073741824 
        MaxWorkGroupSize: 1024 
        Compatible image types: [SignedNormalizedInt8, SignedNormalizedInt16, UnsignedNormalizedInt8, UnsignedNormalizedInt16, SignedInt8, SignedInt16, SignedInt32, UnsignedInt8, UnsignedInt16, UnsignedInt32, HalfFloat, Float]
Best GPU device for images: Quadro M2000
Best largest GPU device: Quadro M2000
Best CPU device: Quadro M2000

Much appreciate your support!
Bram

1 Like

When updated, which version, where downloaded? (-:

Dear @haesleinhuepf
thanks for making this available, great work.
I am already trying it out, and the test code works but then I try to run your


but then get this error:
CLIJ2 error: You are accessing a CLIJ2 plugin (CLIJ2_clear) via CLIJ macro extensions.
Please make sure you run “CLIJ2 Macro Extensions” before calling Ext.CLIJ2 plugins.
java.lang.RuntimeException: Macro canceled
at ij.Macro.abort(Macro.java:76)
at net.haesleinhuepf.clij.macro.CLIJHandler.lambda$handleExtension$0(CLIJHandler.java:156)
at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:97)
at net.haesleinhuepf.clij.clearcl.util.ElapsedTime.measure(ElapsedTime.java:28)
at net.haesleinhuepf.clij.macro.CLIJHandler.handleExtension(CLIJHandler.java:53)
at ij.macro.ExtensionDescriptor.dispatch(ExtensionDescriptor.java:255)
at ij.macro.Functions.doExt(Functions.java:4787)
at ij.macro.Functions.getStringFunction(Functions.java:276)
at ij.macro.Interpreter.getStringTerm(Interpreter.java:1407)
at ij.macro.Interpreter.getString(Interpreter.java:1385)
at ij.macro.Interpreter.doStatement(Interpreter.java:329)
at ij.macro.Interpreter.doStatements(Interpreter.java:261)
at ij.macro.Interpreter.run(Interpreter.java:157)
at ij.macro.Interpreter.run(Interpreter.java:91)
at ij.macro.Interpreter.run(Interpreter.java:102)
at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:161)
at ij.IJ.runMacro(IJ.java:148)
at ij.IJ.runMacro(IJ.java:137)
at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1148)
at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1144)
at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1095)
at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1144)
at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:145)
at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

any ideas?

thanks,
Alvaro

1 Like

Hey Alvaro @acrevenna ,

I apologize for the inconencience. I need to update some example scripts apparently.

Please update this line:

run("CLIJ Macro Extensions", "cl_device=");

to this line:

run("CLIJ2 Macro Extensions", "cl_device=");

This should be it.

Thanks for your feedback! I’ll update the example online and with that, you made CLIJ better today :slight_smile:

Cheers,
Robert

Awesome, thanks! That works.

1 Like

Well, I got them from https://www.nvidia.com/download/index.aspx?lang=en-us.
The latest version is 441.66, which is lower than in the link you send, but that was for Windows 10.
I had already updated to this version about two months ago. I now did it again, with the same version. Same result…

1 Like

Hi @haesleinhuepf,

Another update: exactly the same error happens on a workstation running Windows 7, with a NVIDIA Quadro P5000 card, before and after updating the drivers (to 411.66).

Here’s the CLInfo output:

Available CL backends:
  * net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@70bfcf85
    Functional backend:net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@5aac3312
    Best backend:net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@3921f0be
Used CL backend: net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@74ac6419
ClearCL: ClearCLBase [mClearCLBackendInterface=net.haesleinhuepf.clij.clearcl.backend.jocl.ClearCLBackendJOCL@74ac6419, mPeerPointer=null]
  Number of platforms:1
  [0] NVIDIA CUDA
     Number of devices: 1
     Available devices: 
     [0] Quadro P5000 
        NumberOfComputeUnits: 20 
        Clock frequency: 1733 
        Version: 1.2 
        Extensions: cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_d3d9_sharing cl_nv_d3d10_sharing cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_copy_opts cl_khr_gl_event cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_kernel_attribute_nv 
        GlobalMemorySizeInBytes: 17179869184 
        LocalMemorySizeInBytes: 49152 
        MaxMemoryAllocationSizeInBytes: 4294967296 
        MaxWorkGroupSize: 1024 
        Compatible image types: [SignedNormalizedInt8, SignedNormalizedInt16, UnsignedNormalizedInt8, UnsignedNormalizedInt16, SignedInt8, SignedInt16, SignedInt32, UnsignedInt8, UnsignedInt16, UnsignedInt32, HalfFloat, Float]
Best GPU device for images: Quadro P5000
Best largest GPU device: Quadro P5000
Best CPU device: Quadro P5000

My laptop which gives the same problem does have Windows 10.

I’m afraid the problem is really more general than we thought…
Does it work on your computer(s) without issues?

Bram

1 Like

Alright, I see. I have a suspicion: Older GPU models sometimes don’t support certain data types. While I’m trying to get my hands on a similar GPU, would you mind downloading this clij-core.jar file and replace it with the one in your Fiji installation? Then, try to run your macro again.

clij-core-1.7.0.14-no-image-support.jar.zip (112.0 KB)

Furthermore, the 850M was marketed in 2014 and uses DDR3 RAM. Thus, I would suspect the performance lies below recent CPUs. We can spend some time on making CLIJ work on it. If your boss is reading here: Buy a new Computer for Bram :wink:

With the Quadro M2000 it’s a different story. I’ve developed / tested CLIJ on very similar systems: K2000 and 2000. If I was you, I would uninstall all graphics drivers and install them again, I would download a fresh Fiji and install CLIJ there. I would also test if 3DScript is working and ClearVolume. Both work on OpenCL as well. If all these don’t work, I would suspect hardware issues and replace this GPU as well, even though it’s just 4 years on the market. According to the specs of the M2000, recent RTX gaming cards offer 4-6 times higher memory bandwidth and thus, likely significant speedup.

Let me know if the special clij-core helped!

Hey Bram,

according to the website, version 451.48 is recent for the P5000:
https://www.nvidia.com/Download/driverResults.aspx/161525/en-us

Cheers,
Robert

For Windows 10, yes. Not for Windows 7…

1 Like

Ok. So this is an issue. I don’t have access to Windows 7 manchines. And I worked with the P6000 a lot. I would carefully suspect Windows 7 is the issue then. Could you try the clij-core-jar I uploaded?

Unfortunately, replacing clij-core.jar with your version does not help.
The same errors, plus:
afbeelding

If it’s really a driver issue, Windows 7 users may just be screwed. Time to update! :wink:

I just tried to run the macro with only CLIJ(1) commands: same errors. Still, I’m quite certain that commands like 3Dmedian have worked in the past, with radius >2.

Anyway, my (older) laptop is running Windows 10, but I’m not sure about the NVIDIA driver. When I get home I will update and try again!

Thanks,
Bram

1 Like

So OpenCL started in 2009 and became quite useful around 2013. Windows 7 was discontinued in 2011. So it makes sense… :wink: Thanks for trying anyway. I’ll add an entry to the FAQ about Windows 7

2 Likes