launch matlab with mpi on multiple nodes, missing output files

Hello , I am running matlab program with a batch script which lunches multiple nodes. Within each nodes, there are several independent jobs that are paralleled by parfor loop. Inside the parfor, there is a for loop for saving files.
The code that I am running can be simplified to the following examples.
The matlab code looks like:
-----------------------------------------------------------
my_par=parcluster('local');
my_parallel_job=parpool(my_par,16);
parfor n_loop=1:16
for n_loop_2=1:5
fileid=fopen([my_par.Host num2str(n_loop) '_' ...
num2str(n_loop_2)'.txt'],'w');
fprintf(fileid,'%d \n',n_loop_2);
fclose(fileid);
end
end
delete(my_parallel_job);
exit;
-------------------------------------------------------------
Here is my batch script:
---------------------------------------------------
#!/bin/bash
#SBATCH --ntasks-per-node=1
#SBATCH --partition=cfel
#SBATCH -t 00:10:00
#SBATCH --nodes=2
#SBATCH --job-name name_lalala
#SBATCH --output %j-%N.out
#SBATCH --error %j-%N.err
. /etc/profile.d/modules.sh module load mpi/mpich-3.2-x86_64 module load matlab
mpirun -np 2 matlab -nodisplay -nosplash -r "my_matlab_file_name"
-------------------------------------------------------------
everything works properly when my node number in the batch is 1 (total file number=16*5). But when the nodes are more than 1, some output files are missing.
Could anyone please have any suggestion on what could be happening?
many thanks Lu

답변 (1개)

lu wang
lu wang 2018년 4월 9일

0 개 추천

answer to myself. Use srun and tasks-per-node instead of mpirun.
problem solved

댓글 수: 1

Hi lu wang....Could you please check this question [https://ch.mathworks.com/matlabcentral/answers/451144-error-unexpected-matlab-operator-on-cluster] and tell me about the error and how to resolve the error.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

질문:

2018년 3월 28일

댓글:

2019년 3월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by