|
按照https://help.ubuntu.com/community/MpichCluster 搭了个简单的计算集群,能够跨节点运行mpi_hello程序,但是除了node00能够争取读取.bashrc下的 /home/cluster/HiFiLES-solver外,其余节点不能正确读取。 详细输出可见下面 cluster@node00:~/work$ mpirun -hostfile myhostfile ./mpi_hello I am Process 1 of 8 on node00 The current path is: /home/cluster/HiFiLES-solver I am Process 0 of 8 on node00 The current path is: /home/cluster/HiFiLES-solver I am Process 5 of 8 on node02 The current path is: (null) I am Process 7 of 8 on node02 The current path is: (null) I am Process 2 of 8 on node01 The current path is: (null) I am Process 6 of 8 on node02 The current path is: (null) I am Process 3 of 8 on node01 The current path is: (null) I am Process 4 of 8 on node01 The current path is: (null) 代码可见下方 #include #include / getenv / #include int main(int argc, char* argv) { int myrank, nprocs, namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; const char* HIFILES_DIR; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &myrank); MPI_Get_processor_name(processor_name, &namelen); printf("I am Process %d of %d on %s\n", myrank, nprocs, processor_name); HIFILES_DIR = getenv ("HIFILES_HOME"); printf ("The current path is: %s\n", HIFILES_DIR); MPI_Finalize(); return 0; } 不知道是怎么回事儿?
|