GCTF CUDA library conflicts



Hi all,

First of all, I’m so happy with cryosparc2! It’s so cool. I’m just running into an annoying little problem…

GCtf seems to require cuda 8 libraries, whereas cryosparc2 itself requires cuda-9. How do I tell cryosparc2 to use different cuda libraries for external programs like GCtf? It’s not quite obvious to me where to modify the configuration.

Thanks a bunch, stay awesome.



Hi @ekellogg,

You’re correct, the most recently compiled version of GCTF requires CUDA 8 Libraries. In order to make this work with cryoSPARC instances that use a later version of CUDA, you can edit some code in our GCTF wrapper as a workaround until our next release.

If you navigate to the file cryosparc2_worker/cryosparc2_compute/jobs/ctf/run.py, in run_ctf_estimation_gctf() there is a function called work() around line 738. In there you will see the line:
"path_to_gctf_executable= os.path.join(abs_path_to_gctf_executables,params['path_to_gctf_executable'])

You can modify this line to be:
"path_to_gctf_executable= "export CUDA_PATH=<PATH_TO_CUDA_8> && " + os.path.join(abs_path_to_gctf_executables,params['path_to_gctf_executable'])

This may work on your system. Please note that we have not tested this yet, and is just a suggestion!


Thanks for the suggestion! I found where to alter the code. Do I need to recompile cryosparc2 before testing it out? Thanks


Hi @ekellogg,

You do not. After saving, you can run the same GCTF job normally.


Thanks for the quick response!


Hm. I’ve been trying to figure this out for a while now. The following command works on the command line, even if the path for cuda-8 libraries aren’t set:

 export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64/" && /opt/cryosparc2/cryosparc2_worker/deps/external/gctf-1.06/bin/Gctf-v1.06_sm_30_cu8.0_x86_64 --apix 1.4 --kV 200.0 --Cs 2.7 --ac 0.1 --ctfstar /local/cryosparc2/P4/J79/micrographs_all_gctf.star --input_ctfstar /local/cryosparc2/P4/J79/input_ctfstar.star --gid 0 --boxsize 1024 --boxsuffix _automatch.star --logsuffix _gctf.log

However, when I start a GCTF job within cryosparc it throws this cryptic
error still…


Writing /local/cryosparc2/P4/J79/input_ctfstar.star

Gctf command: export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64/" &amp;&amp; /opt/cryosparc2/cryosparc2_worker/deps/external/gctf-1.06/bin/Gctf-v1.06_sm_30_cu8.0_x86_64 --apix 1.4 --kV 200.0 --Cs 2.7 --ac 0.1 --ctfstar /local/cryosparc2/P4/J79/micrographs_all_gctf.star --input_ctfstar /local/cryosparc2/P4/J79/input_ctfstar.star --gid 0 --boxsize 1024 --boxsuffix _automatch.star --logsuffix _gctf.log

ERROR [Errno 2] No such file or directory


If I execute the same command on the terminal, it runs to completion. I’m not sure what file cryosparc is looking for and can’t find. Any idea?

Thanks a bunch!


Hm… looks like micrographs_all_gctf.star is not where it is supposed to be. I’m confused why this would be happening now with the seemingly unrelated code change I made.


oh i’m dumb… that’s the output, of course. there is some file that needs to be there that is missing it seems…


So… this command works fine on the terminal, but not when I try running cryosparc. I have been trying to figure out what this Error is referring to but I’m afraid we’re out of ideas.

export CUDA_PATH=/usr/local/cuda-8.0 && export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64 && /opt/cryosparc2/cryosparc2_worker/deps/external/gctf-1.06/bin/Gctf-v1.06_sm_30_cu8.0_x86_64 --apix 1.4 --kV 200.0 --Cs 2.7 --ac 0.1 --ctfstar /local/cryosparc2/P4/J79/micrographs_all_gctf.star --input_ctfstar /local/cryosparc2/P4/J79/input_ctfstar.star --gid 0 --boxsize 1024 --boxsuffix _automatch.star --logsuffix _gctf.log


omg… we just ended up reinstalling with cuda 8 libraries. all good now