Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Author: Jasper Grimm (UoY)
easyblock = 'CMakePythonPackage'

name = 'Faiss'
version = '1.7.4'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://github.com/facebookresearch/faiss'
description = """
Faiss is a library for efficient similarity search and clustering of dense
vectors. It contains algorithms that search in sets of vectors of any size, up
to ones that possibly do not fit in RAM. It also contains supporting code for
evaluation and parameter tuning. Faiss is written in C++ with complete
wrappers for Python/numpy. Some of the most useful algorithms are implemented
on the GPU. It is developed primarily at Meta's Fundamental AI Research group.
"""

toolchain = {'name': 'foss', 'version': '2023a'}

github_account = 'facebookresearch'
source_urls = [GITHUB_LOWER_SOURCE]
sources = ['v%(version)s.tar.gz']
checksums = ['d9a7b31bf7fd6eb32c10b7ea7ff918160eed5be04fe63bb7b4b4b5f2bbde01ad']

builddependencies = [
('CMake', '3.26.3'),
('SWIG', '4.1.1'),
]

dependencies = [
('CUDA', '12.1.1', '', SYSTEM),
('Python', '3.11.3'),
('PyTorch', '2.1.2', versionsuffix),
('SciPy-bundle', '2023.07'),
]

_copts = [
'-DFAISS_ENABLE_GPU=ON',
'-DFAISS_ENABLE_PYTHON=ON',
'-DFAISS_ENABLE_C_API=ON',
'-DBUILD_TESTING=ON',
'-DBUILD_SHARED_LIBS=ON',
'-DPython_EXECUTABLE="${EBROOTPYTHON}/bin/python"',
'-DCUDAToolkit_ROOT="${CUDA_ROOT}"',
'-DCMAKE_CUDA_ARCHITECTURES="%(cuda_cc_cmake)s"',
'-DCMAKE_INSTALL_LIBDIR=%(installdir)s/lib',
]

configopts = ' '.join(_copts)

buildopts = 'faiss swigfaiss'

postinstallcmds = [
' && '.join([
# run a pip install in the 'faiss/python' subdir
'cd ../easybuild_obj/%(namelower)s/python',
'python -m pip install --prefix=%(installdir)s --no-build-isolation .',
# for some reason, 'libfaiss_python_callbacks.so' doesn't get installed, so copy this manually
'cp libfaiss_python_callbacks.%s %%(installdir)s/lib/python%%(pyshortver)s/site-packages/faiss' % SHLIB_EXT
])
]

sanity_check_paths = {
'files': ['lib/lib%%(namelower)s.%s' % SHLIB_EXT],
'dirs': ['include/%(namelower)s', 'lib/python%(pyshortver)s/site-packages/%(namelower)s'],
}

moduleclass = 'tools'
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Author: Jasper Grimm (UoY)
easyblock = 'CMakePythonPackage'

name = 't-SNE-CUDA'
version = '3.0.1'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://github.com/CannyLab/tsne-cuda'
description = "GPU Accelerated t-SNE for CUDA with Python bindings"

toolchain = {'name': 'foss', 'version': '2023a'}

source_urls = ['https://github.com/CannyLab/tsne-cuda/archive']
sources = ['%(version)s.tar.gz']
patches = [
'%(name)s-3.0.1_use-external-cxxopts.patch',
'%(name)s-3.0.1_avoid-overriding-cuda-compute-capabilities.patch',
]
checksums = [
{'3.0.1.tar.gz': '0f778247191f483df22dc4dbed792c9a6a9152ee7404329c4d9da3fd9a8774d6'},
{'t-SNE-CUDA-3.0.1_use-external-cxxopts.patch': 'be278f6a122ac12b02e05faffd53f3bce3e58b1d6b40af5e6af6b4182c6a25f1'},
{'t-SNE-CUDA-3.0.1_avoid-overriding-cuda-compute-capabilities.patch':
'09a1ac23c8ca485478fdfccacfe7b04a5608530f3da33892f64c76064a834722'},
]

builddependencies = [
('CMake', '3.26.3'),
('googletest', '1.13.0'),
('cxxopts', '3.0.0', '', SYSTEM),
]

dependencies = [
('Python', '3.11.3'),
('CUDA', '12.1.1', '', SYSTEM),
('Faiss', '1.7.4', versionsuffix),
('gflags', '2.2.2'),
]

_copts = [
'-DBUILD_PYTHON=ON',
'-DWITH_ZMQ=FALSE',
'-DWITH_MKL=OFF',
'-DCMAKE_CUDA_ARCHITECTURES="%(cuda_cc_cmake)s"',
]

configopts = ' '.join(_copts)

install_cmd = ('cd %(builddir)s/easybuild_obj/python &&'
' python -m pip install --prefix=%(installdir)s --no-build-isolation .')

options = {'modulename': 'tsnecuda'}

sanity_check_paths = {
'files': ['lib/python%%(pyshortver)s/site-packages/tsnecuda/libtsnecuda.%s' % SHLIB_EXT],
'dirs': [],
}

moduleclass = 'tools'
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
Avoid overriding CUDA_ARCH if CMAKE_CUDA_ARCHITECTURES is non-empty
diff -Nru tsne-cuda-3.0.1.orig/CMakeLists.txt tsne-cuda-3.0.1/CMakeLists.txt
--- tsne-cuda-3.0.1.orig/CMakeLists.txt 2024-01-18 17:31:58.841767793 +0000
+++ tsne-cuda-3.0.1/CMakeLists.txt 2024-01-18 18:17:35.153863840 +0000
@@ -58,55 +58,56 @@
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()

-if(CUDAToolkit_VERSION_MAJOR EQUAL "10")
- set(CUDA_ARCH
- -gencode=arch=compute_30,code=sm_30
- -gencode=arch=compute_35,code=sm_35
- -gencode=arch=compute_37,code=sm_37
- -gencode=arch=compute_50,code=sm_50
- -gencode=arch=compute_52,code=sm_52
- -gencode=arch=compute_60,code=sm_60
- -gencode=arch=compute_61,code=sm_61
- -gencode=arch=compute_70,code=sm_70
- -gencode=arch=compute_75,code=sm_75
- )
-elseif(CUDAToolkit_VERSION_MAJOR EQUAL "11" AND CUDAToolkit_VERSION_MINOR LESS "1")
- set(CUDA_ARCH
- -gencode=arch=compute_35,code=sm_35
- -gencode=arch=compute_37,code=sm_37
- -gencode=arch=compute_50,code=sm_50
- -gencode=arch=compute_52,code=sm_52
- -gencode=arch=compute_60,code=sm_60
- -gencode=arch=compute_61,code=sm_61
- -gencode=arch=compute_70,code=sm_70
- -gencode=arch=compute_75,code=sm_75
- -gencode=arch=compute_80,code=sm_80
- )
-elseif(CUDAToolkit_VERSION_MAJOR EQUAL "11")
- set(CUDA_ARCH
- -gencode=arch=compute_35,code=sm_35
- -gencode=arch=compute_37,code=sm_37
- -gencode=arch=compute_50,code=sm_50
- -gencode=arch=compute_52,code=sm_52
- -gencode=arch=compute_60,code=sm_60
- -gencode=arch=compute_61,code=sm_61
- -gencode=arch=compute_70,code=sm_70
- -gencode=arch=compute_75,code=sm_75
- -gencode=arch=compute_80,code=sm_80
- -gencode=arch=compute_86,code=sm_86
- )
-else()
- set(CUDA_ARCH
- -gencode=arch=compute_30,code=sm_30
- -gencode=arch=compute_35,code=sm_35
- -gencode=arch=compute_37,code=sm_37
- -gencode=arch=compute_50,code=sm_50
- -gencode=arch=compute_52,code=sm_52
- -gencode=arch=compute_60,code=sm_60
- -gencode=arch=compute_61,code=sm_61
+if("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
+ if(CUDAToolkit_VERSION_MAJOR EQUAL "10")
+ set(CUDA_ARCH
+ -gencode=arch=compute_30,code=sm_30
+ -gencode=arch=compute_35,code=sm_35
+ -gencode=arch=compute_37,code=sm_37
+ -gencode=arch=compute_50,code=sm_50
+ -gencode=arch=compute_52,code=sm_52
+ -gencode=arch=compute_60,code=sm_60
+ -gencode=arch=compute_61,code=sm_61
+ -gencode=arch=compute_70,code=sm_70
+ -gencode=arch=compute_75,code=sm_75
)
-endif()
-
+ elseif(CUDAToolkit_VERSION_MAJOR EQUAL "11" AND CUDAToolkit_VERSION_MINOR LESS "1")
+ set(CUDA_ARCH
+ -gencode=arch=compute_35,code=sm_35
+ -gencode=arch=compute_37,code=sm_37
+ -gencode=arch=compute_50,code=sm_50
+ -gencode=arch=compute_52,code=sm_52
+ -gencode=arch=compute_60,code=sm_60
+ -gencode=arch=compute_61,code=sm_61
+ -gencode=arch=compute_70,code=sm_70
+ -gencode=arch=compute_75,code=sm_75
+ -gencode=arch=compute_80,code=sm_80
+ )
+ elseif(CUDAToolkit_VERSION_MAJOR EQUAL "11")
+ set(CUDA_ARCH
+ -gencode=arch=compute_35,code=sm_35
+ -gencode=arch=compute_37,code=sm_37
+ -gencode=arch=compute_50,code=sm_50
+ -gencode=arch=compute_52,code=sm_52
+ -gencode=arch=compute_60,code=sm_60
+ -gencode=arch=compute_61,code=sm_61
+ -gencode=arch=compute_70,code=sm_70
+ -gencode=arch=compute_75,code=sm_75
+ -gencode=arch=compute_80,code=sm_80
+ -gencode=arch=compute_86,code=sm_86
+ )
+ else()
+ set(CUDA_ARCH
+ -gencode=arch=compute_30,code=sm_30
+ -gencode=arch=compute_35,code=sm_35
+ -gencode=arch=compute_37,code=sm_37
+ -gencode=arch=compute_50,code=sm_50
+ -gencode=arch=compute_52,code=sm_52
+ -gencode=arch=compute_60,code=sm_60
+ -gencode=arch=compute_61,code=sm_61
+ )
+ endif()
+endif()

set(CUDA_OPTS
-O3
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Update CMakeLists.txt to use an external cxxopts
diff -Nru tsne-cuda-3.0.1.orig/CMakeLists.txt tsne-cuda-3.0.1/CMakeLists.txt
--- tsne-cuda-3.0.1.orig/CMakeLists.txt 2024-01-18 17:31:58.841767793 +0000
+++ tsne-cuda-3.0.1/CMakeLists.txt 2024-01-18 17:34:46.095207526 +0000
@@ -157,6 +157,14 @@
endif()
include_directories(${FAISS_INCLUDE_DIR})

+# CXXOPTS Configuration
+#-------------------------------------------------------------------------------
+find_package(CXXOPTS REQUIRED)
+if(NOT ${CXXOPTS_FOUND})
+ message("-- CXXOPTS not installed. PLease install CXXOPTS.")
+endif()
+include_directories(${CXXOPTS_INCLUDE_DIR})
+
# Project Setup
#-------------------------------------------------------------------------------
include_directories(
@@ -164,7 +172,6 @@
src/include
${CUDA_INCLUDE_DIRS}
third_party/
- third_party/cxxopts/include/
${ZMQ_INCLUDE_DIR}
)
link_directories(