在使用英特尔MPI实现并使用ifort编译代码时,我在MPI_COMM_SPAWN_MULTIPLE
内崩溃。使用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)