Headless FIJI - specify number of threads

Hello everybody,

I’m playing with FIJI in headless mode on a cluster. When I allocate only one core to each job (--cpus-per-task=1), it doesn’t work. When I set the number of core to 4, it runs smoothly. The macro I run simply displays “Hello world!”, so nothing fancy in this side.

  • It is possible to run ImageJ with only one core ?
  • If yes, how ? Is there a command line option like --nthread=1 ?


I’ve found it can be easier to let the queue manager on clusters handle allocation of resources. It depends on your cluster’s setup but slurm/torque/etc typically have a way to only allocate a single core to a script. That way Fiji doesn’t even know it could run on multiple.

1 Like

Thanks for your message!
So our cluster is using slurm.

Hum, I believed this is what I set with the line --cpus-per-task=1 (I’m new to this cluster thing, so I may be wrong here). This line is in the bash file before launching ImageJ. However when I set:

  • --cpus-per-task=1 -> it crashes
  • --cpus-per-task=2 -> it crashes
  • --cpus-per-task=4 -> it’s ok

Yeah but are we sure it can ? Did you try with a single core and was it ok? I’ll be very insterested to know.

In what way does it crash? Any error/log messages?

1 Like


Googled it, so it was most probably a memory error (oom-kill -> out of memory error). I increased to 2 GB of memory instead of 1, and it worked for any core numbers. For the record, to set the memory in headless mode: