mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-03 21:44:33 +00:00 
			
		
		
		
	Merge branch 'develop' into feature/json-fix
This commit is contained in:
		@@ -195,7 +195,8 @@ public:
 | 
			
		||||
#endif
 | 
			
		||||
    size_type bytes = __n*sizeof(_Tp);
 | 
			
		||||
    uint8_t *cp = (uint8_t *)ptr;
 | 
			
		||||
#pragma omp parallel for
 | 
			
		||||
    // One touch per 4k page, static OMP loop to catch same loop order
 | 
			
		||||
#pragma omp parallel for schedule(static)
 | 
			
		||||
    for(size_type n=0;n<bytes;n+=4096){
 | 
			
		||||
      cp[n]=0;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,10 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
#include <sys/ipc.h>
 | 
			
		||||
#include <sys/shm.h>
 | 
			
		||||
#include <sys/mman.h>
 | 
			
		||||
//#include <zlib.h>
 | 
			
		||||
#include <zlib.h>
 | 
			
		||||
#ifdef HAVE_NUMAIF_H
 | 
			
		||||
#include <numaif.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef SHM_HUGETLB
 | 
			
		||||
#define SHM_HUGETLB 04000
 | 
			
		||||
#endif
 | 
			
		||||
@@ -214,6 +217,25 @@ void CartesianCommunicator::Init(int *argc, char ***argv) {
 | 
			
		||||
      void * ptr =  mmap(NULL,size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
 | 
			
		||||
      if ( ptr == MAP_FAILED ) {       perror("failed mmap");      assert(0);    }
 | 
			
		||||
      assert(((uint64_t)ptr&0x3F)==0);
 | 
			
		||||
 | 
			
		||||
      // Try to force numa domain on the shm segment if we have numaif.h
 | 
			
		||||
#ifdef HAVE_NUMAIF_H
 | 
			
		||||
	int status;
 | 
			
		||||
	int flags=MPOL_MF_MOVE;
 | 
			
		||||
#ifdef KNL
 | 
			
		||||
	int nodes=1; // numa domain == MCDRAM
 | 
			
		||||
	// Find out if in SNC2,SNC4 mode ?
 | 
			
		||||
#else
 | 
			
		||||
	int nodes=r; // numa domain == MPI ID
 | 
			
		||||
#endif
 | 
			
		||||
	unsigned long count=1;
 | 
			
		||||
	for(uint64_t page=0;page<size;page+=4096){
 | 
			
		||||
	  void *pages = (void *) ( page + (uint64_t)ptr );
 | 
			
		||||
	  uint64_t *cow_it = (uint64_t *)pages;	*cow_it = 1;
 | 
			
		||||
	  ierr= move_pages(0,count, &pages,&nodes,&status,flags);
 | 
			
		||||
	  if (ierr && (page==0)) perror("numa relocate command failed");
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
      ShmCommBufs[r] =ptr;
 | 
			
		||||
      
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user