mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Improvements to huge memory
This commit is contained in:
parent
b331be9101
commit
c05b2199f6
@ -157,6 +157,7 @@ void CartesianCommunicator::ShmInitGeneric(void){
|
|||||||
perror("mmap failed ");
|
perror("mmap failed ");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
if (!Hugepages ) madvise(ShmCommBuf,MAX_MPI_SHM_BYTES,MADV_HUGEPAGE);
|
||||||
#else
|
#else
|
||||||
ShmBufStorageVector.resize(MAX_MPI_SHM_BYTES);
|
ShmBufStorageVector.resize(MAX_MPI_SHM_BYTES);
|
||||||
ShmCommBuf=(void *)&ShmBufStorageVector[0];
|
ShmCommBuf=(void *)&ShmBufStorageVector[0];
|
||||||
|
@ -198,7 +198,7 @@ void CartesianCommunicator::Init(int *argc, char ***argv) {
|
|||||||
ShmCommBuf = 0;
|
ShmCommBuf = 0;
|
||||||
ShmCommBufs.resize(ShmSize);
|
ShmCommBufs.resize(ShmSize);
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
char shm_name [NAME_MAX];
|
char shm_name [NAME_MAX];
|
||||||
if ( ShmRank == 0 ) {
|
if ( ShmRank == 0 ) {
|
||||||
for(int r=0;r<ShmSize;r++){
|
for(int r=0;r<ShmSize;r++){
|
||||||
@ -240,7 +240,7 @@ void CartesianCommunicator::Init(int *argc, char ***argv) {
|
|||||||
if (ierr && (page==0)) perror("numa relocate command failed");
|
if (ierr && (page==0)) perror("numa relocate command failed");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ShmCommBufs[r] =ptr;
|
ShmCommBufs[r] =ptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,18 +269,22 @@ void CartesianCommunicator::Init(int *argc, char ***argv) {
|
|||||||
if ( ShmRank == 0 ) {
|
if ( ShmRank == 0 ) {
|
||||||
for(int r=0;r<ShmSize;r++){
|
for(int r=0;r<ShmSize;r++){
|
||||||
size_t size = CartesianCommunicator::MAX_MPI_SHM_BYTES;
|
size_t size = CartesianCommunicator::MAX_MPI_SHM_BYTES;
|
||||||
key_t key = 0x4545 + r;
|
key_t key = IPC_PRIVATE;
|
||||||
int flags = IPC_CREAT | SHM_R | SHM_W;
|
int flags = IPC_CREAT | SHM_R | SHM_W;
|
||||||
#ifdef SHM_HUGETLB
|
#ifdef SHM_HUGETLB
|
||||||
flags|=SHM_HUGETLB;
|
if (Hugepages) flags|=SHM_HUGETLB;
|
||||||
#endif
|
#endif
|
||||||
if ((shmids[r]= shmget(key,size, flags)) < 0) {
|
if ((shmids[r]= shmget(key,size, flags)) ==-1) {
|
||||||
int errsv = errno;
|
int errsv = errno;
|
||||||
printf("Errno %d\n",errsv);
|
printf("Errno %d\n",errsv);
|
||||||
|
printf("key %d\n",key);
|
||||||
|
printf("size %lld\n",size);
|
||||||
|
printf("flags %d\n",flags);
|
||||||
perror("shmget");
|
perror("shmget");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
} else {
|
||||||
|
printf("shmid: 0x%x\n", shmids[r]);
|
||||||
}
|
}
|
||||||
printf("shmid: 0x%x\n", shmids[r]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MPI_Barrier(ShmComm);
|
MPI_Barrier(ShmComm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user