Skip to content

Commit

Permalink
Add internal CUDA header patch for PSM2
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoldeman committed Jun 12, 2024
1 parent bfc2938 commit ed860fd
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 7 deletions.
4 changes: 3 additions & 1 deletion easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-10.3.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 3 additions & 1 deletion easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.2.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 3 additions & 1 deletion easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-11.3.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 3 additions & 1 deletion easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.2.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 3 additions & 1 deletion easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-12.3.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 3 additions & 1 deletion easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.2.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 3 additions & 1 deletion easybuild/easyconfigs/p/PSM2/PSM2-12.0.1-GCCcore-13.3.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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 <stddef.h>
+
+#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 */

0 comments on commit ed860fd

Please sign in to comment.