diff --git a/Grid/communicator/SharedMemoryMPI.cc b/Grid/communicator/SharedMemoryMPI.cc index 466f6a1e..786122fa 100644 --- a/Grid/communicator/SharedMemoryMPI.cc +++ b/Grid/communicator/SharedMemoryMPI.cc @@ -35,6 +35,9 @@ Author: Christoph Lehner #endif #ifdef GRID_HIP #include +#endif +#ifdef GRID_SYCl + #endif NAMESPACE_BEGIN(Grid); @@ -446,7 +449,46 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags) //////////////////////////////////////////////////////////////////////////////////////////// // Hugetlbfs mapping intended //////////////////////////////////////////////////////////////////////////////////////////// -#if defined(GRID_CUDA) ||defined(GRID_HIP) +#if defined(GRID_CUDA) ||defined(GRID_HIP) || defined(GRID_SYCL) + +#if defined(GRID_SYCL) +void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags) +{ + void * ShmCommBuf ; + assert(_ShmSetup==1); + assert(_ShmAlloc==0); + + ////////////////////////////////////////////////////////////////////////////////////////////////////////// + // allocate the pointer array for shared windows for our group + ////////////////////////////////////////////////////////////////////////////////////////////////////////// + MPI_Barrier(WorldShmComm); + WorldShmCommBufs.resize(WorldShmSize); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Each MPI rank should allocate our own buffer + /////////////////////////////////////////////////////////////////////////////////////////////////////////// + ShmCommBuf = acceleratorAllocDevice(bytes); + + if (ShmCommBuf == (void *)NULL ) { + std::cerr << " SharedMemoryMPI.cc acceleratorAllocDevice failed NULL pointer for " << bytes<<" bytes " << std::endl; + exit(EXIT_FAILURE); + } + // if ( WorldRank == 0 ){ + if ( 1 ){ + std::cout << WorldRank << header " SharedMemoryMPI.cc acceleratorAllocDevice "<< bytes + << "bytes at "<< std::hex<< ShmCommBuf <