Skip to content

Commit

Permalink
Merge branch 'easybuilders:develop' into 20250108170217_new_pr_whispe…
Browse files Browse the repository at this point in the history
…r-ctranslate2052
  • Loading branch information
pavelToman authored Jan 10, 2025
2 parents 90b7f98 + 254236f commit 2741459
Show file tree
Hide file tree
Showing 8 changed files with 354 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
easyblock = 'CMakeMake'

name = 'CTranslate2'
version = '4.5.0'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://opennmt.net/CTranslate2/'
description = "Fast inference engine for Transformer models."

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

source_urls = ['https://github.com/OpenNMT/CTranslate2/archive/']
sources = [{
"download_filename": "v%(version)s.tar.gz",
"filename": SOURCE_TAR_GZ,
}]
patches = [
'CTranslate2-4.5.0_fix-third-party.patch',
'CTranslate2-4.5.0_fix-tests.patch',
'CTranslate2-4.5.0_replace-cxxopts.patch',
]
checksums = [
{'CTranslate2-4.5.0.tar.gz': 'f3040c7c3da5dde022fdc16906c279f3f936c6e79f3df8f998c908bb01a77cfe'},
{'CTranslate2-4.5.0_fix-third-party.patch': '45ab6d19954010dc5d515498a0827f0b13992d88b9691ab73ab27fee1114e3e3'},
{'CTranslate2-4.5.0_fix-tests.patch': '73123eafe612538354be5aa96c750199e1a219a5316800848c3894c1cc6ca2ad'},
{'CTranslate2-4.5.0_replace-cxxopts.patch': 'e378969c2968e2fd57863956a4d2f267731a49d1b890dcc45593d6a310531271'},
]

builddependencies = [
('CMake', '3.26.3'),
('pybind11', '2.11.1'),
('cxxopts', '3.0.0', '', SYSTEM),
('spdlog', '1.11.0'),
('cpu_features', '0.9.0'),
]

dependencies = [
('CUDA', '12.6.0', '', SYSTEM),
('Python', '3.11.3'),
('SciPy-bundle', '2023.07'),
('googletest', '1.13.0'),
('PyYAML', '6.0'),
('cuDNN', '9.5.0.50', versionsuffix, SYSTEM),
]

# make sure that CTranslate2 libraries are linked to FlexiBLAS, not OpenBLAS
preconfigopts = "export CMAKE_INCLUDE_PATH=$EBROOTFLEXIBLAS/include/flexiblas:${CMAKE_INCLUDE_PATH} && "
preconfigopts += "sed -i 's/openblas/flexiblas/g' %(start_dir)s/CMakeLists.txt && "

configopts = '-DOPENMP_RUNTIME=COMP -DWITH_CUDA=ON -DWITH_MKL=OFF '
configopts += '-DOPENBLAS_INCLUDE_DIR="$EBROOTFLEXIBLAS/include" -DWITH_OPENBLAS=ON '
configopts += '-DWITH_CUDNN=ON '
configopts += '-DENABLE_CPU_DISPATCH=OFF '

prebuildopts = 'export CT2_VERBOSE=3 && '

exts_defaultclass = 'PythonPackage'
exts_default_options = {
'source_urls': [PYPI_SOURCE],
'download_dep_fail': True,
'use_pip': True,
'sanity_pip_check': True,
'installopts': '',
'runtest': False,
}

exts_list = [
('ctranslate2', version, {
'sources': ['CTranslate2-%(version)s.tar.gz'],
'start_dir': 'python',
'checksums': ['f3040c7c3da5dde022fdc16906c279f3f936c6e79f3df8f998c908bb01a77cfe'],
}),
]

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

sanity_check_commands = [
"ct2-translator --help",
"python -c 'import ctranslate2'",
"python -m pip check",
]

modextrapaths = {'PYTHONPATH': 'lib/python%(pyshortver)s/site-packages'}

moduleclass = 'ai'
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Author: Pavel Tománek (pavelToman)
Fix compilation of tests + replace third_party GTest by one from EB.
--- tests/CMakeLists.txt.orig 2025-01-03 16:35:23.243495904 +0100
+++ tests/CMakeLists.txt 2025-01-03 17:34:04.044755825 +0100
@@ -2,7 +2,7 @@

option(BUILD_GMOCK "" OFF)
option(INSTALL_GTEST "" OFF)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third_party/googletest ${CMAKE_CURRENT_BINARY_DIR}/googletest)
+find_package(GTest)

add_executable(ctranslate2_test
batching_test.cc
@@ -21,6 +21,7 @@
target_link_libraries(ctranslate2_test
${PROJECT_NAME}
gtest_main
+ gtest
)

add_executable(benchmark_ops
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Author: Pavel Tománek (pavelToman)
Replace recursively downloaded third party sw with programs from EB.
--- CMakeLists.txt.orig 2025-01-03 16:15:51.023557000 +0100
+++ CMakeLists.txt 2025-01-08 15:50:57.345502000 +0100
@@ -95,7 +95,7 @@
endif()

find_package(Threads)
-add_subdirectory(third_party/spdlog EXCLUDE_FROM_ALL)
+find_package(spdlog)

set(PRIVATE_INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}/src
@@ -246,7 +246,7 @@
set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
set(BUILD_SHARED_LIBS OFF)
set(BUILD_TESTING OFF)
- add_subdirectory(third_party/cpu_features EXCLUDE_FROM_ALL)
+ find_package(CpuFeatures)
set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}")
list(APPEND LIBRARIES cpu_features)
endif()
@@ -498,19 +498,6 @@
message(STATUS "NVCC host compiler: ${CUDA_HOST_COMPILER}")
message(STATUS "NVCC compilation flags: ${CUDA_NVCC_FLAGS}")

- # We should ensure that the Thrust include directories appear before
- # -I/usr/local/cuda/include for both GCC and NVCC, so that the headers
- # are coming from the submodule and not the system.
- set(THRUST_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/third_party/thrust/dependencies/cub
- ${CMAKE_CURRENT_SOURCE_DIR}/third_party/thrust
- )
- cuda_include_directories(${THRUST_INCLUDE_DIRS})
- list(APPEND PRIVATE_INCLUDE_DIRECTORIES ${THRUST_INCLUDE_DIRS})
-
- set(CUTLASS_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/third_party/cutlass/include
- )
cuda_include_directories(${CUTLASS_INCLUDE_DIRS})
list(APPEND PRIVATE_INCLUDE_DIRECTORIES ${CUTLASS_INCLUDE_DIRS})

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Author: Pavel Tománek (pavelToman)
Replace recursively downloaded third party cxxopts with cxxopts from EB.
--- cli/CMakeLists.txt.orig 2025-01-03 16:47:35.863270652 +0100
+++ cli/CMakeLists.txt 2025-01-03 16:52:02.988342754 +0100
@@ -1,15 +1,9 @@
-if (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../third_party/cxxopts/include")
- message(FATAL_ERROR "The client dependency repository (cxxopts) is missing! "
- "You probably didn't clone the project with --recursive. You can include it "
- "by calling \"git submodule update --init --recursive\"")
-endif()
-
add_executable(translator
translator.cc
)
target_include_directories(translator
- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/cxxopts/include
- )
+ PRIVATE "$ENV{EBROOTCXXOPTS}/include"
+)
target_link_libraries(translator
PRIVATE ${PROJECT_NAME}
)
32 changes: 32 additions & 0 deletions easybuild/easyconfigs/c/CastXML/CastXML-0.6.10-GCCcore-13.2.0.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
easyblock = 'CMakeMake'

name = 'CastXML'
version = '0.6.10'

homepage = 'https://github.com/CastXML/CastXML'
description = """CastXML is a C-family abstract syntax tree XML output tool."""

toolchain = {'name': 'GCCcore', 'version': '13.2.0'}

github_account = 'CastXML'
source_urls = [GITHUB_SOURCE]
sources = ['v%(version)s.tar.gz']
checksums = ['d8498b39b4cf3d57671254056013de177f47fc7a2683f1a53049ab854d85ad55']

builddependencies = [
('binutils', '2.40'),
('CMake', '3.27.6'),
]

dependencies = [
('Clang', '17.0.6'),
('ncurses', '6.4'),
('zlib', '1.2.13'),
]

sanity_check_paths = {
'files': ['bin/castxml'],
'dirs': ['share/castxml'],
}

moduleclass = 'tools'
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file is an EasyBuild reciPY as per https://github.com/easybuilders/easybuild
# Author: Denis Kristak, update: Pavel Tománek
easyblock = 'CMakeMake'

name = 'cpu_features'
version = '0.9.0'

homepage = 'https://github.com/google/cpu_features'
description = """A cross-platform C library to retrieve CPU features (such as available instructions) at runtime."""

toolchain = {'name': 'GCCcore', 'version': '12.3.0'}
toolchainopts = {'pic': True}

source_urls = ['https://github.com/google/cpu_features/archive/']
sources = ['v%(version)s.tar.gz']
checksums = ['bdb3484de8297c49b59955c3b22dba834401bc2df984ef5cfc17acbe69c5018e']

builddependencies = [
('CMake', '3.26.3'),
('binutils', '2.40'),
]

modextrapaths = {'CPATH': 'include/cpu_features'}

sanity_check_paths = {
'files': ['bin/list_cpu_features', 'lib/libcpu_features.a'],
'dirs': ['include/cpu_features/']
}

sanity_check_commands = ['list_cpu_features']

moduleclass = 'tools'
90 changes: 90 additions & 0 deletions easybuild/easyconfigs/i/ITK/ITK-5.4.0-foss-2023b.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Contributors:
# Fenglai Liu (fenglai@accre.vanderbilt.edu) - Vanderbilt University
# Alex Domingo (alex.domingo.toro@vub.be) - Vrije Universiteit Brussel (VUB)
# Denis Kristak (INUITS), Pavel Tománek (INUITS)

easyblock = 'CMakeMake'

name = 'ITK'
version = '5.4.0'

homepage = 'https://itk.org'
description = """Insight Segmentation and Registration Toolkit (ITK) provides
an extensive suite of software tools for registering and segmenting
multidimensional imaging data."""

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

github_account = 'InsightSoftwareConsortium'
source_urls = [GITHUB_SOURCE]
sources = ['v%(version)s.tar.gz']
patches = [
'ITK-5.3.0_add-vtk-include-dir.patch',
]
checksums = [
{'v5.4.0.tar.gz': 'd71a36fc0aee2c9257fe128f7657feb1e671461bd48561b620619f290c71795e'},
{'ITK-5.3.0_add-vtk-include-dir.patch': 'df7e834a024db5d1a1459d898bd43a044351e29759ab0bf69ce03d64da95b3f7'},
]

builddependencies = [
('CMake', '3.27.6'),
('Bison', '3.8.2'),
('Eigen', '3.4.0'),
('SWIG', '4.3.0'),
('Perl', '5.38.0'),
('git', '2.42.0'),
]
dependencies = [
('Python', '3.11.5'),
('SciPy-bundle', '2023.11'),
('double-conversion', '3.3.0'),
('expat', '2.5.0'),
('HDF5', '1.14.3'),
('libjpeg-turbo', '3.0.1'),
('libpng', '1.6.40'),
('LibTIFF', '4.6.0'),
('VTK', '9.3.0'),
('zlib', '1.2.13'),
('CastXML', '0.6.10'),
]

# Features
configopts = '-DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF '
configopts += '-DModule_ITKReview=ON -DModule_ITKVtkGlue=ON -DModule_SimpleITKFilters=ON '
# Enable Python bindings
configopts += '-DITK_WRAP_PYTHON:BOOL=ON -DPython3_EXECUTABLE=$EBROOTPYTHON/bin/python '
configopts += '-DSWIG_EXECUTABLE=$EBROOTSWIG/bin/swig -DSWIG_DIR=$EBROOTSWIG '
configopts += '-DPY_SITE_PACKAGES_PATH=%(installdir)s/lib/python%(pyshortver)s/site-packages '
# Dependencies from EB
local_sys_deps = [
'CASTXML',
'DOUBLECONVERSION',
'EIGEN',
'EXPAT',
'FFTW',
'HDF5',
'JPEG',
'PNG',
'SWIG',
'TIFF',
'ZLIB'
]
local_sys_cmake = ['-DITK_USE_SYSTEM_%s=ON' % d for d in local_sys_deps]
configopts += ' '.join(local_sys_cmake)

prebuildopts = 'LC_ALL=C '

local_lib_names = ['ITKCommon', 'ITKIOHDF5', 'ITKIOJPEG', 'ITKIOPNG', 'ITKIOTIFF',
'ITKReview', 'ITKVTK', 'ITKVtkGlue', 'itkSimpleITKFilters']

sanity_check_paths = {
'files': ['bin/itkTestDriver'] +
['lib/lib%s-%%(version_major)s.%%(version_minor)s.%s' % (lname, SHLIB_EXT) for lname in local_lib_names],
'dirs': ['include/ITK-%(version_major)s.%(version_minor)s', 'lib/python%(pyshortver)s/site-packages', 'share'],
}

sanity_check_commands = ["python -c 'import itk'"]

modextrapaths = {'PYTHONPATH': 'lib/python%(pyshortver)s/site-packages'}

moduleclass = 'data'
27 changes: 27 additions & 0 deletions easybuild/easyconfigs/s/SWIG/SWIG-4.3.0-GCCcore-13.2.0.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name = 'SWIG'
version = '4.3.0'

homepage = 'http://www.swig.org/'
description = """SWIG is a software development tool that connects programs written in C and C++ with
a variety of high-level programming languages."""

toolchain = {'name': 'GCCcore', 'version': '13.2.0'}
toolchainopts = {'pic': True}

source_urls = [SOURCEFORGE_SOURCE]
sources = [SOURCELOWER_TAR_GZ]
checksums = ['f7203ef796f61af986c70c05816236cbd0d31b7aa9631e5ab53020ab7804aa9e']

builddependencies = [
('binutils', '2.40'),
('Bison', '3.8.2'),
]

dependencies = [
('zlib', '1.2.13'),
('PCRE2', '10.42'),
]

configopts = '--without-alllang --with-boost=no'

moduleclass = 'devel'

0 comments on commit 2741459

Please sign in to comment.