- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
My program calls a function and it receives two files name that are build in for command. Its goal is read a number of mol2 files and create pdbqt files. Therefore, I create a loop in which each file mol2 file name is created pdbqt file. My part of the code is below:
#pragma omp parallel shared(m,mol2_size) private(path_file_mol2, path_file_pdbqt, file_pdbqt, base_file_name) { path_file_mol2 = (char*)malloc(sizeof(char)*MAX_PATH_FILE_NAME); path_file_pdbqt = (char*)malloc(sizeof(char)*MAX_PATH_FILE_NAME); file_pdbqt = (char*)malloc(sizeof(char)*MAX_FILE_NAME); base_file_name = (char*)malloc(sizeof(char)*MAX_FILE_NAME); #pragma omp for for (m = 0; m < mol2_size; m++){ //Obtaing base file name. This is file name without its extension set_base_file_name(base_file_name, all_mol2_files.file_name, ex_mol2); strcpy(file_pdbqt, base_file_name); add_ext_file_name(file_pdbqt, ex_pdbqt); //mol2 file strcpy(path_file_mol2, param->path_mol2); strcat(path_file_mol2, all_mol2_files .file_name); //pdbqt files strcpy(path_file_pdbqt, param->path_compounds); strcat(path_file_pdbqt, file_pdbqt); call_prepare_ligand(param, path_file_mol2, path_file_pdbqt); } free(base_file_name); free(file_pdbqt); free(path_file_pdbqt); free(path_file_mol2); }
I can not understand why my code is working fine when threads number is equal than number of files. In my test, I have 4 mol2 files. When I execute my program with mpirun -np 4 /home/faccioli/workspace/drugdesign/virtualscreening/build/./prepare_ligand config.conf it works fine: 4 pdbq files are created. However, when I execute mpirun -np 2 /home/faccioli/workspace/drugdesign/virtualscreening/build/./prepare_ligand config.conf 2 pdbqt files are created.
I attached my entire code.
I appreciate any help.
Best regards,
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you running mpi thread funneled mode (openmp within each rank under mpi)? Your mpirun np parameter controls number of ranks while omp_num_threads must be set to number of threads per rank.
I hope you're not trying to make each thread of each rank open a file. I'm on a PadFone without internet so can't examine your full example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for your attention.
I have used OpenMP instead of MPI. In fact I will run it in shared memory.
I understood about mpirun program. Therefore, I have to set omp_num_threads using it as environment variable. I use Debian, export OMP_NUM_THREADS=number, where number means the number of threads that I want to run.
Although I have looked, I could not figure out if it is possible to set omp_num_threads in run time. Is it possible?
Best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you aren't using mpi then mpirun isn't useful, nor is this forum a good choice.
Besides environment variable, you have the possibilities of omp_set_num_threads function call and num_threads clause in omp parallel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I appreciate your help.
Best regards,

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page