Quantcast
Channel: Clusters and HPC Technology
Viewing all articles
Browse latest Browse all 927

OpenMP problem with Threads Number

$
0
0

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[m].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[m].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, 

Fichier attachéTaille
Téléchargerprepare_ligand.c2.91 Ko

Viewing all articles
Browse latest Browse all 927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>