From ed860fd33282ef52f72c99855d0c8fa7c04cfd51 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Wed, 12 Jun 2024 14:00:41 +0000 Subject: [PATCH] Add internal CUDA header patch for PSM2 --- .../p/PSM2/PSM2-12.0.1-GCCcore-10.3.0.eb | 4 +- .../p/PSM2/PSM2-12.0.1-GCCcore-11.2.0.eb | 4 +- .../p/PSM2/PSM2-12.0.1-GCCcore-11.3.0.eb | 4 +- .../p/PSM2/PSM2-12.0.1-GCCcore-12.2.0.eb | 4 +- .../p/PSM2/PSM2-12.0.1-GCCcore-12.3.0.eb | 4 +- .../p/PSM2/PSM2-12.0.1-GCCcore-13.2.0.eb | 4 +- .../p/PSM2/PSM2-12.0.1-GCCcore-13.3.0.eb | 4 +- ....0.1_build-with-internal-cuda-header.patch | 88 +++++++++++++++++++ 8 files changed, 109 insertions(+), 7 deletions(-) create mode 100644 easybuild/easyconfigs/p/PSM2/PSM2-12.0.1_build-with-internal-cuda-header.patch diff --git a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-10.3.0.eb b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-10.3.0.eb index a7f0ee5d469..1f6981d1dae 100644 --- a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-10.3.0.eb +++ b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-10.3.0.eb @@ -15,15 +15,17 @@ source_urls = ['https://github.com/cornelisnetworks/opa-psm2/archive/refs/tags'] sources = ['%(name)s_%(version)s.tar.gz'] patches = [ ('PSM2-11.2.80_hfi-user.patch', 1), + ('PSM2-12.0.1_build-with-internal-cuda-header.patch', 1), ] checksums = [ {'PSM2_12.0.1.tar.gz': 'e41af2d7d36a6ab67639ecbd5c1012aa20b2b464bf5cfbdac60e7eb37bfe58de'}, {'PSM2-11.2.80_hfi-user.patch': 'e43138859387213506050af9b76e193c3cd0a162d148998c39e551f220392abb'}, + {'PSM2-12.0.1_build-with-internal-cuda-header.patch': + '0016327d7eade9e763ffbc468cf25c182d743074dca2885dea7ef0cf7e3b23cf'}, ] builddependencies = [ ('binutils', '2.36.1'), - ('CUDA', '11.3.1', '', SYSTEM), ] dependencies = [ diff --git a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.2.0.eb b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.2.0.eb index 779d6bcdd0a..325c404a055 100644 --- a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.2.0.eb +++ b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.2.0.eb @@ -15,15 +15,17 @@ source_urls = ['https://github.com/cornelisnetworks/opa-psm2/archive/refs/tags'] sources = ['%(name)s_%(version)s.tar.gz'] patches = [ ('PSM2-11.2.80_hfi-user.patch', 1), + ('PSM2-12.0.1_build-with-internal-cuda-header.patch', 1), ] checksums = [ {'PSM2_12.0.1.tar.gz': 'e41af2d7d36a6ab67639ecbd5c1012aa20b2b464bf5cfbdac60e7eb37bfe58de'}, {'PSM2-11.2.80_hfi-user.patch': 'e43138859387213506050af9b76e193c3cd0a162d148998c39e551f220392abb'}, + {'PSM2-12.0.1_build-with-internal-cuda-header.patch': + '0016327d7eade9e763ffbc468cf25c182d743074dca2885dea7ef0cf7e3b23cf'}, ] builddependencies = [ ('binutils', '2.37'), - ('CUDA', '11.5.2', '', SYSTEM), ] dependencies = [ diff --git a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.3.0.eb b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.3.0.eb index 7fa4c192e3b..b93b34dc43e 100644 --- a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.3.0.eb +++ b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.3.0.eb @@ -15,15 +15,17 @@ source_urls = ['https://github.com/cornelisnetworks/opa-psm2/archive/refs/tags'] sources = ['%(name)s_%(version)s.tar.gz'] patches = [ ('PSM2-11.2.80_hfi-user.patch', 1), + ('PSM2-12.0.1_build-with-internal-cuda-header.patch', 1), ] checksums = [ {'PSM2_12.0.1.tar.gz': 'e41af2d7d36a6ab67639ecbd5c1012aa20b2b464bf5cfbdac60e7eb37bfe58de'}, {'PSM2-11.2.80_hfi-user.patch': 'e43138859387213506050af9b76e193c3cd0a162d148998c39e551f220392abb'}, + {'PSM2-12.0.1_build-with-internal-cuda-header.patch': + '0016327d7eade9e763ffbc468cf25c182d743074dca2885dea7ef0cf7e3b23cf'}, ] builddependencies = [ ('binutils', '2.38'), - ('CUDA', '11.7.0', '', SYSTEM), ] dependencies = [ diff --git a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.2.0.eb b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.2.0.eb index fbf417d2bc8..fa91a78538e 100644 --- a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.2.0.eb +++ b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.2.0.eb @@ -15,15 +15,17 @@ source_urls = ['https://github.com/cornelisnetworks/opa-psm2/archive/refs/tags'] sources = ['%(name)s_%(version)s.tar.gz'] patches = [ ('PSM2-11.2.80_hfi-user.patch', 1), + ('PSM2-12.0.1_build-with-internal-cuda-header.patch', 1), ] checksums = [ {'PSM2_12.0.1.tar.gz': 'e41af2d7d36a6ab67639ecbd5c1012aa20b2b464bf5cfbdac60e7eb37bfe58de'}, {'PSM2-11.2.80_hfi-user.patch': 'e43138859387213506050af9b76e193c3cd0a162d148998c39e551f220392abb'}, + {'PSM2-12.0.1_build-with-internal-cuda-header.patch': + '0016327d7eade9e763ffbc468cf25c182d743074dca2885dea7ef0cf7e3b23cf'}, ] builddependencies = [ ('binutils', '2.39'), - ('CUDA', '12.0.0', '', SYSTEM), ] dependencies = [ diff --git a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.3.0.eb b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.3.0.eb index 0470fe64363..169b08b1e36 100644 --- a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.3.0.eb +++ b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.3.0.eb @@ -15,15 +15,17 @@ source_urls = ['https://github.com/cornelisnetworks/opa-psm2/archive/refs/tags'] sources = ['%(name)s_%(version)s.tar.gz'] patches = [ ('PSM2-11.2.80_hfi-user.patch', 1), + ('PSM2-12.0.1_build-with-internal-cuda-header.patch', 1), ] checksums = [ {'PSM2_12.0.1.tar.gz': 'e41af2d7d36a6ab67639ecbd5c1012aa20b2b464bf5cfbdac60e7eb37bfe58de'}, {'PSM2-11.2.80_hfi-user.patch': 'e43138859387213506050af9b76e193c3cd0a162d148998c39e551f220392abb'}, + {'PSM2-12.0.1_build-with-internal-cuda-header.patch': + '0016327d7eade9e763ffbc468cf25c182d743074dca2885dea7ef0cf7e3b23cf'}, ] builddependencies = [ ('binutils', '2.40'), - ('CUDA', '12.1.1', '', SYSTEM), ] dependencies = [ diff --git a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.2.0.eb b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.2.0.eb index cfe3fe9f1e4..ee265c55610 100644 --- a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.2.0.eb +++ b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.2.0.eb @@ -15,15 +15,17 @@ source_urls = ['https://github.com/cornelisnetworks/opa-psm2/archive/refs/tags'] sources = ['%(name)s_%(version)s.tar.gz'] patches = [ ('PSM2-11.2.80_hfi-user.patch', 1), + ('PSM2-12.0.1_build-with-internal-cuda-header.patch', 1), ] checksums = [ {'PSM2_12.0.1.tar.gz': 'e41af2d7d36a6ab67639ecbd5c1012aa20b2b464bf5cfbdac60e7eb37bfe58de'}, {'PSM2-11.2.80_hfi-user.patch': 'e43138859387213506050af9b76e193c3cd0a162d148998c39e551f220392abb'}, + {'PSM2-12.0.1_build-with-internal-cuda-header.patch': + '0016327d7eade9e763ffbc468cf25c182d743074dca2885dea7ef0cf7e3b23cf'}, ] builddependencies = [ ('binutils', '2.40'), - ('CUDA', '12.4.0', '', SYSTEM), ] dependencies = [ diff --git a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.3.0.eb b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.3.0.eb index 78d99d2efec..aff3d686fc7 100644 --- a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.3.0.eb +++ b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.3.0.eb @@ -15,15 +15,17 @@ source_urls = ['https://github.com/cornelisnetworks/opa-psm2/archive/refs/tags'] sources = ['%(name)s_%(version)s.tar.gz'] patches = [ ('PSM2-11.2.80_hfi-user.patch', 1), + ('PSM2-12.0.1_build-with-internal-cuda-header.patch', 1), ] checksums = [ {'PSM2_12.0.1.tar.gz': 'e41af2d7d36a6ab67639ecbd5c1012aa20b2b464bf5cfbdac60e7eb37bfe58de'}, {'PSM2-11.2.80_hfi-user.patch': 'e43138859387213506050af9b76e193c3cd0a162d148998c39e551f220392abb'}, + {'PSM2-12.0.1_build-with-internal-cuda-header.patch': + '0016327d7eade9e763ffbc468cf25c182d743074dca2885dea7ef0cf7e3b23cf'}, ] builddependencies = [ ('binutils', '2.42'), - ('CUDA', '12.4.0', '', SYSTEM), ] dependencies = [ diff --git a/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1_build-with-internal-cuda-header.patch b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1_build-with-internal-cuda-header.patch new file mode 100644 index 00000000000..3e3ffd8038e --- /dev/null +++ b/easybuild/easyconfigs/p/PSM2/PSM2-12.0.1_build-with-internal-cuda-header.patch @@ -0,0 +1,88 @@ +Allow building PSM2 without a CUDA builddependency, by providing an +internal minimal cuda.h header file. +As long as the runtime CUDA version is 8.0+, libcuda.so will be dlopen'ed and +used successfully. + +Author: Bart Oldeman +diff -urN opa-psm2-PSM2_12.0.1.orig/include/cuda.h opa-psm2-PSM2_12.0.1/include/cuda.h +--- opa-psm2-PSM2_12.0.1.orig/include/cuda.h 1970-01-01 00:00:00.000000000 +0000 ++++ opa-psm2-PSM2_12.0.1/include/cuda.h 2024-06-11 18:39:38.242975935 +0000 +@@ -0,0 +1,73 @@ ++/* This header provides minimal parts of the CUDA Driver API, without having to ++ rely on the proprietary CUDA toolkit. ++ ++ References (to avoid copying from NVidia's proprietary cuda.h): ++ https://github.com/gcc-mirror/gcc/blob/master/include/cuda/cuda.h ++ https://github.com/Theano/libgpuarray/blob/master/src/loaders/libcuda.h ++ https://github.com/CPFL/gdev/blob/master/cuda/driver/cuda.h ++ https://github.com/CudaWrangler/cuew/blob/master/include/cuew.h ++*/ ++ ++#ifndef PSM2_CUDA_H ++#define PSM2_CUDA_H ++ ++#include ++ ++#define CUDA_VERSION 8000 ++ ++typedef void *CUcontext; ++typedef int CUdevice; ++#if defined(__LP64__) || defined(_WIN64) ++typedef unsigned long long CUdeviceptr; ++#else ++typedef unsigned CUdeviceptr; ++#endif ++typedef void *CUevent; ++typedef void *CUstream; ++ ++typedef enum { ++ CUDA_SUCCESS = 0, ++ CUDA_ERROR_ALREADY_MAPPED = 208, ++ CUDA_ERROR_NOT_READY = 600, ++} CUresult; ++ ++enum { ++ CU_EVENT_DEFAULT = 0x0, ++}; ++ ++enum { ++ CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = 0x1, ++}; ++ ++typedef enum { ++ CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 2, ++ CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = 6, ++ CU_POINTER_ATTRIBUTE_IS_MANAGED = 8, ++} CUpointer_attribute; ++ ++ ++typedef enum { ++ CU_MEMORYTYPE_HOST = 0x01, ++ CU_MEMORYTYPE_DEVICE = 0x02, ++} CUmemorytype; ++ ++#define CU_IPC_HANDLE_SIZE 64 ++ ++typedef struct CUipcMemHandle_st { ++ char reserved[CU_IPC_HANDLE_SIZE]; ++} CUipcMemHandle; ++ ++typedef enum { ++ CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41, ++ CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75, ++} CUdevice_attribute; ++ ++enum { ++ CU_STREAM_NON_BLOCKING = 1 ++}; ++ ++enum { ++ CU_MEMHOSTALLOC_PORTABLE = 0x01, ++}; ++ ++#endif +diff -urN opa-psm2-PSM2_12.0.1.orig/include/driver_types.h opa-psm2-PSM2_12.0.1/include/driver_types.h +--- opa-psm2-PSM2_12.0.1.orig/include/driver_types.h 1970-01-01 00:00:00.000000000 +0000 ++++ opa-psm2-PSM2_12.0.1/include/driver_types.h 2024-06-12 13:46:04.123858352 +0000 +@@ -0,0 +1 @@ ++/* this file is empty */