MPI_COMM_SPAWN_MULTIPLE
使用英特尔 MPI 实现并使用 ifort 编译代码时,我遇到了内部崩溃。相同的代码使用 OpenMPI 并使用 gfortran 编译没有问题。相关代码贴在下面。
ALLOCATE(commands(num_processes - 1))
ALLOCATE(args(num_processes - 1,2))
ALLOCATE(info(num_processes - 1))
ALLOCATE(max_procs(num_processes - 1))
ALLOCATE(error_array(num_processes - 1))
commands = TRIM(context%cl_parser%command)
args(:,1) = temp_string
IF (num_threads .lt. 0) THEN
args(:,2) = '-para=-1'
ELSE IF (num_threads .lt. 10) THEN
WRITE (temp_string, 1001) num_threads
args(:,2) = TRIM(temp_string)
ELSE
WRITE (temp_string, 1002) num_threads
args(:,2) = TRIM(temp_string)
END IF
max_procs = 1
DO i = 2, num_processes
CALL MPI_INFO_CREATE(info(i - 1), error)
CALL MPI_INFO_SET(info(i - 1), "wdir", process_dir(i), &
& error)
END DO
CALL MPI_COMM_SPAWN_MULTIPLE(num_processes - 1, commands, args, &
& max_procs, info, 0, &
& MPI_COMM_WORLD, child_comm, &
& error_array, error)
CALL MPI_INTERCOMM_MERGE(child_comm, .false., &
& context%intra_comm, error)
DO i = 1, num_processes - 1
CALL MPI_INFO_FREE(info(i), error)
END DO
DEALLOCATE(info)
DEALLOCATE(max_procs)
DEALLOCATE(args)
DEALLOCATE(commands)
DEALLOCATE(error_array)