Top Page > Browsing
Memcpy argument memory ranges overlap with MPICH2 (SOLVED)
Date: 2017/05/21 22:11
Name: Kylin

Dear all
last night, I found the update of new version of gcc-7+mpich may invoke the memcpy error during the mpi communication. I found it was attributed to the the self-to-self memory copy with the pointer to the same memory range. You could test the following code:

void MPI_Isendrecv_self()
{
char greeting[MAX_STRING];
MPI_Request req;

int oldrank,oldsize;
MPI_Comm_rank(MPI_COMM_WORLD, &oldrank);
MPI_Comm_size(MPI_COMM_WORLD, &oldsize);
if(oldrank==0){
sprintf( greeting , "old rank = %d old size = %d\n" , oldrank , oldsize);
MPI_Isend(greeting,strlen(greeting)+1,MPI_CHAR,0,0,MPI_COMM_WORLD,&req);
printf("send has done\n");
MPI_Recv(greeting,MAX_STRING,MPI_CHAR,0,0,MPI_COMM_WORLD,MPI_STATUS_IGNORE);
printf("%s\n",greeting);
}
}

The above function may failed in certain version of mpich2 but passed in open-mpi which is the compilation environment for openmx. But if you still want to do it with mpich or encounter the similar problem, (e.g. try Cr2.dat file in input_example), you could try to modify the code with following principle (skip the self-to-self mpi communication):

========= Eigen_PHH.c (Line 599) =============
for (ID=0; ID<nump; ID++){
IDS = (myid + ID) % nump + ID0;
if(IDS == myid) continue;
MPI_Isend(&a1d[2*k0-1], 2*num0, MPI_DOUBLE, IDS, tag, MPI_Current_Comm_WD, &request_send[IDS-ID0]);
}

/* receiving */

for (ID=0; ID<nump; ID++){
IDR = (myid - ID + nump) % nump + ID0;
if(IDR == myid) continue;
num1 = ie2[IDR] - is2[IDR] + 2;
k1 = is2[IDR] + (IDR - ID0);
MPI_Irecv(&a1d[2*k1-1], 2*num1, MPI_DOUBLE, IDR, tag, MPI_Current_Comm_WD, &request_recv[IDR-ID0]);
}

/* waitall */
request_recv[myid-ID0] = MPI_REQUEST_NULL;
request_send[myid-ID0]= MPI_REQUEST_NULL;

MPI_Waitall(nump,request_recv,stat_send);
MPI_Waitall(nump,request_send,stat_send);
========= End of Eigen_PHH.c =============
by adding "continue" and " MPI_REQUEST_NULL" command into Eigen_PHH.c and Eigen_PReHH.c, you may solve this problem.

Cheers
Kylin
メンテ
Page: [1]

Re: Memcpy argument memory ranges overlap with MPICH2 (SOLVED) ( No.1 )
Date: 2017/05/24 09:26
Name: T. Ozaki

Hi,

Thank you for your valuable report.
To increase the transferability of OpenMX to a wide range of environments,
your suggestion should be addressed. We will address the issue at a proper
occasion.

Regards,

TO
メンテ

Page: [1]

Title (must) Move the thread to the top
Your Name (must)
E-Mail (must)
URL
Password (used in modification of the submitted text)
Comment (must)

   Save Cookie