我怀疑我没有正确提供文件路径 - 我不是一个 linux 人,所以我不知道真正可能出了什么问题 - 代码:
int main(int argc, char** argv) {
// ...
char *filename = argv[3];
MPI_Init(&argc, &argv);
const int rank = get_rank();
if (!rank) printf("%s\n", argv[3]); // /home/users1/stdxx/public_html/grid.txt
// ...
MPI_File * fh;
if (!rank) {
fprintf(stderr, "%d\n", rank); // I see this : 0
if (MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY,
MPI_INFO_NULL, fh) != MPI_SUCCESS) {
fprintf(stderr, "Cannot open file %s\n", filename); // never seen
}
// rest runs fine if I comment out the MPI_File_open call
}
int get_rank() {
int rank = -1;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
return rank;
}
即使我给出无效路径也会挂起
如果我注释掉 if (!rank)
它会崩溃:
rank 6 in job 54 linux21_60559 caused collective abort of all ranks
exit status of rank 6: killed by signal 11
rank 8 in job 54 linux21_60559 caused collective abort of all ranks
exit status of rank 8: killed by signal 11
rank 5 in job 54 linux21_60559 caused collective abort of all ranks
exit status of rank 5: killed by signal 9
rank 4 in job 54 linux21_60559 caused collective abort of all ranks
exit status of rank 4: killed by signal 11
rank 2 in job 54 linux21_60559 caused collective abort of all ranks
exit status of rank 2: killed by signal 9
rank 1 in job 54 linux21_60559 caused collective abort of all ranks
exit status of rank 1: killed by signal 9
另一方面,如果我给它一条路径, sftp://stdxxxxx@linux11.di.uoa.gr/home/users1/stdxxxxx/public_html/grid.txt
它会以它快乐的方式到达Cannot open file sftp://stdxxxxx@linux11.di.uoa.gr/home/users1/stdxxxxx/public_html/grid.txt
为什么 ?
在 Linux 机器集群中通过 netbeans 远程运行它。命令 :
/usr/local/mpich2/bin/mpiexec -machinefile 机器 -np 9 "${OUTPUT_PATH}" 84 9 /home/users1/stdxxxxx/public_html/grid.txt
"${OUTPUT_PATH}"
是可执行文件
mpirun --version
或mpiexec --version
导致invalid "local" arg: --version
编辑 :
mpicc -v
mpicc for 1.1.1p1
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4)