Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminating: fork() called from a process already using GNU OpenMP, this is unsafe. #9

Open
Accompany0313 opened this issue Apr 8, 2024 · 3 comments

Comments

@Accompany0313
Copy link

Hi Ye,

Nice work!

I got an error:
" /MNT/second_drive/user_data ygc/local/lib/python3.8 / site - packages/sklearn/utils/deprecation py: 86: FutureWarning: Function setup_anndata is deprecated; Please use the model-specific setup_anndata methods instead. The global method will be removed in version 0.15.0.
warnings.warn(msg, category=FutureWarning)
INFO Using batches from adata.obs["batch"]
INFO No label_key inputted, assuming all cells have same label
INFO Using data from adata.X
Terminating: fork() called from a process already using GNU OpenMP, this is unsafe.
/ MNT/second_drive/user_data ygc/local/lib/python3.8 / site - packages/sklearn/utils/deprecation py: 86: FutureWarning: Function setup_anndata is deprecated; Please use the model-specific setup_anndata methods instead. The global method will be removed in version 0.15.0.
warnings.warn(msg, category=FutureWarning)
INFO Using batches from adata.obs["batch"]
INFO No label_key inputted, assuming all cells have same label
INFO Using data from adata.X
Terminating: fork() called from a process already using GNU OpenMP, this is unsafe."

I have no idea what could cause the error. The command I use is:
python scripts/scVI-3D.py -b 10 -c "whole" -r 1000000 -i "demoData" -o "results" -cs "supplementaryData/demoData_summary.txt"
-g "supplementaryData/hg19.chrom.sizes" -br -n 100 -gpu -p 10 -pca 50 -up -tp -v

Could you please help me with it? Thank you so much!

@yezhengSTAT
Copy link
Owner

Hello,
It seems that the newer version of sklearn package that you probably is using has deprecated setup_anndata function. I think we developed the package using 0.24.2 version of scikit-learn (for other python module, the version we used can be found at https://github.com/yezhengSTAT/scVI-3D#1-preparation). Sorry for the trouble as we did not expect the new dependent tool is not compatible with its old version.

Thanks,
Ye

@yezhengSTAT
Copy link
Owner

The version compatibility issue indeed needs some further adjustment work, but I guess that will only give us warning messages. Terminating errors related to fork() and GNU OpenMP is the critical error stopping your process. The error message "Terminating: fork() called from a process already using GNU OpenMP, this is unsafe" suggests that your script or one of the libraries it uses tries to use multiprocessing in a way that's not safe or compatible with OpenMP (Open Multi-Processing), which is used for parallel programming in C/C++ and Fortran. This error can occur when a process that's already running in a parallelized manner (using OpenMP) attempts to spawn new processes (via fork() in Python). This is often unsafe because it can lead to deadlocks or other concurrency issues. Maybe try to use one thread by setting OMP_NUM_THREADS=1?

@Accompany0313
Copy link
Author

Thank you very much for your advice. I tried to set OMP_NUM_THREADS=1 first, but the same problem still occurred. I tried again to set the number of cpus to 1, and this time the problem was resolved. However, the running time has been extended from 15 minutes to more than two hours. Finally, I would like to express my sincere thanks for your reply.

The command I use is:
python scripts/scVI-3D.py -b 10 -c "whole" -r 1000000 -i "demoData" -o "results" -cs "supplementaryData/demoData_summary.txt"
-g "supplementaryData/hg19.chrom.sizes" -br -n 100 -gpu -p 1 -pca 50 -up -tp -v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants