Hello,

I am trying to port a simple halo exchange program from C to fortran. It is designed to demonstrate the shared memory features of MPI-3. The original C program was download from an Intel site, and I have modified it to simplify the port. A tarfile of a directory with each program and example outputs is attached. To test use Open-MPI 1.10.3rc1 (which supports MPI-3), and do :

mpicc testmpi3.c
mpif90 -np 8 a.out | sort > outc

and

mpif90 testmpi3.f90
mpif90 -np 8 a.out | sort > outf

Comparing outc and outf, you can see that 'testmpi3.c' runs correctly, loading variable values from on-node processors as well as from off-node. 'testmpi3.f90' does not work correctly, as it cannot mimic the inter-node C pointers. 'testmpi3.c' correctly loads variable values from addresses, while 'testmpi3.f90' just loads the addresses. Line 141 in 'testmpi3.c' and line 94 in 'testmpi3.f90' are the companion lines of interest. I am not a C programmer, but as I understand it, the ** syntax of line 28 defines the variable 'shar_pntr' as a 'pointer to a pointer'. This seems to be the secret, but unfortunately I haven't found a way to do the same in fortran. Does anyone have a suggestion? Is this a case where a C function must be called from fortran to perform this kind of operation?

T. Rosmond

PS: Running gcc version 4.4.7 20120313 (Red Hat 4.4.7-16), IFORT 12.0.3.174, and Open-MPI 1.10.3rc1


Attachment: testmpi3.tar
Description: Unix tar archive

Reply via email to