CLIJ2 BETA testing - call for testers 👷

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

sorry for jumping on the topic,
does Clij2 implement some 3D convolution/cross-correlation algorithm performed on GPU?
Thanks
Emanuele

1 Like

Unfortunately, this is my personal and only laptop (which is even more sad, isn’t it?)

That said, I’m still quite happy with the 850M. It outperforms a workstation dual CPUs (Intel Xeon E5-2643 v4 @ 3.4 GHz (2 x 6 cores), so total 24 threads, 100% load) on 3DGaussian and 3DMean by a factor 8 and 40, respectively! :sunglasses:

(with 2DMean it is roughly equal)

1 Like

Hey @emartini,

any question is welcome here! :slight_smile:

CLIJ2 supports convolution and some experimental code for cross-correlation is available in CLIJx. The cross-correlation is running under the hood of some more particle-image-velocimetry and deformable image registration tools. Thus, if you want to go further in this direction, I could point you to even more experimental code :wink:

Let me know if you need anything else.

Cheers,
Robert

1 Like

Hi @haesleinhuepf,

Short update on my issue:
On my laptop (Windows 10) I ran the macro in the following configurations:

  • Intel HD Graphics 4600 - Succes!
  • NVIDIA GeForce 850M + 2019 driver - Error
  • NVIDIA GeForce 850M + new driver (version 451.48) - Error
  • NVIDIA GeForce 850M + new driver (version 451.48) + special clij-core jar- Error

I was really hoping that the new NVIDIA driver would fix it on Windows 10, because then we could just narrow it down to Windows 7. Now, it could be that, and, independently, my ‘old’ NVIDIA 850M GPU not supporting everything necessary, which would somehow lead to the same error messages, and also only for median commands radius > 2. I find that quite unlikely. Plus, I have definitely used commands like 3DMedian before without problems on this computer. :thinking:

By the way, we had already planned an upgrade of our workstations to Windows 10. I’ll let you know if the error persists there. (But that should not be possible).

enjoy the weekend!
Bram

1 Like

I just tried on a NVidia 960M and your macro works. I have no older GPU of similar kind accessible :wink: I’m running a bit out of ideas. More things you can try:

  • Uninstall driver (using device manager), install it from scratch
  • Download a fresh Fiji, only install clij and clij2
  • Restart computer

Furthermore, does 3DScript and ClearVolume run?

Let me know how I can help further. And have a nice weekend as well :slight_smile:

Cheers,
Robert

1 Like