Cellprofiler 3.1.8 headless multi-threaded (?)

Hi,

as far as I read on https://github.com/CellProfiler/CellProfiler/wiki/Adapting-CellProfiler-to-a-LIMS-environment CP is using single threads when running in headless mode, which is good.
However when we ran our jobs using CP 3.1.8 (Linux, conda installation) in headless mode on our cluster, we noticed that CP is starting as many threads as the machine has cores, that’s bad because if there are multiple jobs running on a single cluster node the node gets overloaded.

$ ps ax | grep 57429
57429 ? Rl 1356:21 /usr/local/bioinf/conda/envs/cellprofiler-3.1.8/bin/python /usr/local/bioinf/conda/envs/cellprofiler-3.1.8/bin/cellprofiler -p ./mypipeline.cppipe -c -r --out
put-directory=./results/result_list_test --file-list=./file_lists/list.txt

$ cat /proc/57429/status | grep Threads
Threads: 132

Is this intended? How can we limit CP to make sure that only a single thread is started?

Thanks
D.Rieder

Hi, I noticed the same behaviour on our SLURM managed cluster and it is also a problem for our setup because of overloading of the nodes.

This the cellprofiler start command:

cellprofiler -c -p $ORIG_DIR/conf/$CPPIPE.cppipe -r \
             --file-list=$ORIG_DIR/${FOLDER}_images.txt \
             -o $OUTPUT/$(((SLURM_ARRAY_TASK_ID - 1) * 72 + 1)) -L 10 \
             -f $(((SLURM_ARRAY_TASK_ID - 1) * 72 + 1)) -l $((SLURM_ARRAY_TASK_ID * 72)) \
             -t $TMP_DIR

Could you please advise on how to enforce the single-thread mode of CellProfiler as described in https://github.com/CellProfiler/CellProfiler/wiki/Adapting-CellProfiler-to-a-LIMS-environment?

Many thanks for your help.

Kind regards,
Axel

I had a similar problem which I think was caused by numpy. You could try prefixing your cellprofiler command with OMP_NUM_THREADS=1 or setting it as an environment variable in your submission script. Depends on your setup, it might be OPENBLAS_NUM_THREADS or MKL_NUM_THREADS

1 Like

Hi,

thanks for this hint, I’ll test it and report back.

D.Rieder

Setting MKL_NUM_THREADS=1 did resolve the issue for me!

THANKS A LOT!!! I would not have thought of this.

Kind regards,
Axel

1 Like