문제

I suspect that I don't give the file path correctly - I am not a linux guy so I don't know what may be wrong really - code :

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;
}

hangs even if I give an invalid path
If I comment out the if (!rank) it crashes with :

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 

If on the other hand I give it a path of the form sftp://stdxxxxx@linux11.di.uoa.gr/home/users1/stdxxxxx/public_html/grid.txt it goes its merry way to Cannot open file sftp://stdxxxxx@linux11.di.uoa.gr/home/users1/stdxxxxx/public_html/grid.txt

Why ?

Running this remotely via netbeans in a cluster of linux machines. Command :

/usr/local/mpich2/bin/mpiexec -machinefile machines -np 9 "${OUTPUT_PATH}" 84 9 /home/users1/stdxxxxx/public_html/grid.txt

"${OUTPUT_PATH}" is the executable

mpirun --version or mpiexec --version result in invalid "local" arg: --version

EDIT :

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)
도움이 되었습니까?

해결책

And the winner is :

MPI_File * fh = malloc(sizeof * fh);

argghh - the simple joys of C

Still interested in why it does not crash when I give it the sftp: uris (I guess because it never gets to the pointer part) - and what is the right way to construct the filename1 - so I am not accepting my answer yet.

1 : from here :

The format for specifying the file name in the filename argument is implementation dependent and must be documented by the implementation.

and

On some implementations of MPI, the file namespace may not be identical from all processes of all applications. For example, "c:\tmp\foo" may denote different files on different processes, or a single file may have many names, dependent on process location. The user is responsible for ensuring that a single file is referenced by the filename argument, as it may be impossible for an implementation to detect this type of namespace error.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top