Hello Folks,
I am very familiar with programming in C and MPI. However, I am fairly new to Fortran.
In a given fortran application, I am trying to replace the regular allocate() function with MPI_Alloc_mem. MPI_Alloc_mem will just return a pointer to a memory region that the MPI library allocates, as requested by the user. The following piece of code, with 1-D integer arrays seems to work fine.
type(c_ptr) :: baseptr
integer, pointer :: sbuf
alloc_size=length*itemsize*size
call MPI_alloc_mem (alloc_size, MPI_INFO_NULL, baseptr, ierr)
call c_f_pointer(baseptr, sbuf, alloc_size)
sbuf = 0
..
However, if an application deals with dynamic 2-D arrays, that are allocated as:
complex(mytype), save, allocatable :: buf1,
allocate(buf1(nm,2),stat=err)
I am not too sure how to replace the allocate call with MPI_Alloc_mem(). I would greatly appreciate it if someone could help me out.
Thanks,
KK
I am very familiar with programming in C and MPI. However, I am fairly new to Fortran.
In a given fortran application, I am trying to replace the regular allocate() function with MPI_Alloc_mem. MPI_Alloc_mem will just return a pointer to a memory region that the MPI library allocates, as requested by the user. The following piece of code, with 1-D integer arrays seems to work fine.
type(c_ptr) :: baseptr
integer, pointer :: sbuf
alloc_size=length*itemsize*size
call MPI_alloc_mem (alloc_size, MPI_INFO_NULL, baseptr, ierr)
call c_f_pointer(baseptr, sbuf, alloc_size)
sbuf = 0
..
However, if an application deals with dynamic 2-D arrays, that are allocated as:
complex(mytype), save, allocatable :: buf1,
allocate(buf1(nm,2),stat=err)
I am not too sure how to replace the allocate call with MPI_Alloc_mem(). I would greatly appreciate it if someone could help me out.
Thanks,
KK