diff --git a/easybuild/easyconfigs/t/Triton/Triton-2.3.1-foss-2023b-CUDA-12.4.0.eb b/easybuild/easyconfigs/t/Triton/Triton-2.3.1-foss-2023b-CUDA-12.4.0.eb new file mode 100644 index 000000000000..27418217576b --- /dev/null +++ b/easybuild/easyconfigs/t/Triton/Triton-2.3.1-foss-2023b-CUDA-12.4.0.eb @@ -0,0 +1,112 @@ +easyblock = 'PythonBundle' + +name = 'Triton' +version = '2.3.1' +versionsuffix = '-CUDA-%(cudaver)s' + +homepage = 'https://triton-lang.org/' + +description = """Triton is a language and compiler for parallel programming. It aims to provide a +Python-based programming environment for productively writing custom DNN compute +kernels capable of running at maximal throughput on modern GPU hardware.""" + +toolchain = {'name': 'foss', 'version': '2023b'} + +builddependencies = [ + ('CMake', '3.27.6'), + ('Ninja', '1.11.1'), + # LLVM dependencies + ('git', '2.42.0'), + ('libxml2', '2.11.5'), + ('ncurses', '6.4'), +] + +dependencies = [ + ('CUDA', '12.4.0', '', SYSTEM), + ('Python', '3.11.5'), + ('Python-bundle-PyPI', '2023.10'), + ('SciPy-bundle', '2023.11'), + ('lit', '18.1.7'), + ('pybind11', '2.11.1'), + ('Z3', '4.13.0'), + # LLVM dependencies + ('zlib', '1.2.13'), +] + +components = [ + # Hash from cmake/llvm-hash.txt + ('LLVM', '5e5a22caf88ac1ccfa8dc5720295fdeba0ad9372', { + 'easyblock': 'CMakeNinja', + 'source_urls': ['https://github.com/llvm/llvm-project/archive/'], + 'sources': [{ + 'download_filename': '%(version)s.tar.gz', + 'filename': 'llvm-project-%(version)s.tar.gz', + }], + 'checksums': [ + {'llvm-project-5e5a22caf88ac1ccfa8dc5720295fdeba0ad9372.tar.gz': + '9d9ae8ae30f6262ca0823493893398ea2ab6fbd49027e338e06ac7c25bb8caf4'}, + ], + 'start_dir': 'llvm-project-%(version)s', + 'separate_build_dir': 'llvm_build_dir', + 'configopts': ' '.join([ + # Reduce dependencies + '-DLLVM_ENABLE_BINDINGS=OFF', # Requires OCAML + '-DLLVM_ENABLE_LIBEDIT=OFF', + # See https://github.com/triton-lang/triton/blob/develop/scripts/build-llvm-project.sh + '-DCMAKE_BUILD_TYPE="Release"', + '-DLLVM_CCACHE_BUILD=OFF', + '-DLLVM_ENABLE_ASSERTIONS=ON', + '-DLLVM_OPTIMIZED_TABLEGEN=ON', + '-DLLVM_TARGETS_TO_BUILD="Native;NVPTX;AMDGPU"', + '-DLLVM_ENABLE_PROJECTS="mlir;llvm"', + ]), + 'srcdir': 'llvm', + 'skipsteps': ['install'], + }) +] + +local_preinstallopts = ' '.join([ + 'TRITON_BUILD_WITH_CLANG_LLD=0', + "TRITON_HOME='%(builddir)s/triton_home'", + 'TRITON_PTXAS_PATH="$CUDA_HOME/bin/ptxas"', + 'TRITON_CUOBJDUMP_PATH="$CUDA_HOME/bin/cubjdump"', + 'TRITON_NVDISASM_PATH="$CUDA_HOME/bin/nvdisasm"', + 'LLVM_SYSPATH="%(builddir)s/llvm_build_dir"', + 'JSON_SYSPATH="$EBROOTNLOHMANN_JSON"', + 'PYBIND11_SYSPATH="$EBROOTPYBIND11"', + 'MAX_JOBS=%(parallel)s', + # Build type + 'DEBUG=0 REL_WITH_DEB_INFO=0 TRITON_REL_BUILD_WITH_ASSERTS=1', + "TRITON_APPEND_CMAKE_ARGS='-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON'", +]) + ' ' + +exts_list = [ + (name, version, { + # make pip print output of cmake + 'installopts': "-v ", + # ensure that libdevice.10.bc from $EBROOTCUDA/nvvm/libdevice is used: + 'postinstallcmds': [ + 'rm -rf %(installdir)s/lib/python%(pyshortver)s/site-packages/triton/backends/nvidia/lib/libdevice.10.bc' + ], + 'preinstallopts': local_preinstallopts, + 'source_urls': ['https://github.com/triton-lang/triton/archive/'], + 'sources': [{ + 'filename': SOURCE_TAR_GZ, + 'download_filename': '958fccea74da58e7e0595ab88ae6cd3f6795a173.tar.gz', + }], + 'patches': ['Triton-2.3.1_disable-dependency-download.patch'], + 'checksums': [ + {'Triton-2.3.1.tar.gz': '07d67f6e00de85cb4cace1fe716a22e6eaf623712137d21276445392d0475c44'}, + {'Triton-2.3.1_disable-dependency-download.patch': + '8a768a27b378521967f91536cd13ff315efb966d2dc6a9710c8818c60fb688fe'}, + ], + 'start_dir': 'python', + }), +] + +modextravars = { + 'TRITON_PTXAS_PATH': '$CUDA_HOME/bin/ptxas', + # ensure that libdevice.10.bc from $EBROOTCUDA/nvvm/libdevice is used: + 'TRITON_LIBDEVICE_PATH': '$CUDA_HOME/nvvm/libdevice/libdevice.10.bc' +} +moduleclass = 'devel' diff --git a/easybuild/easyconfigs/t/Triton/Triton-2.3.1_disable-dependency-download.patch b/easybuild/easyconfigs/t/Triton/Triton-2.3.1_disable-dependency-download.patch new file mode 100644 index 000000000000..26a0a53b1f15 --- /dev/null +++ b/easybuild/easyconfigs/t/Triton/Triton-2.3.1_disable-dependency-download.patch @@ -0,0 +1,33 @@ +Error when downloads would happen in setup.py + +Author: Alexander Grund (TU Dresden) + +diff --git a/python/setup.py b/python/setup.py +index cef967241..47976b1be 100644 +--- a/python/setup.py ++++ b/python/setup.py +@@ -115,6 +115,7 @@ def get_thirdparty_packages(triton_cache_path): + version_file_path = os.path.join(package_dir, "version.txt") + if p.syspath_var_name not in os.environ and\ + (not os.path.exists(version_file_path) or Path(version_file_path).read_text() != p.url): ++ raise RuntimeError('Forbidden download') + try: + shutil.rmtree(package_root_dir) + except Exception: +@@ -139,6 +140,7 @@ def get_thirdparty_packages(triton_cache_path): + def download_and_copy(src_path, variable, version, url_func): + if variable in os.environ: + return ++ raise RuntimeError('Forbidden download') + base_dir = os.path.dirname(__file__) + arch = platform.machine() + if arch == "x86_64": +@@ -280,7 +282,7 @@ class CMakeBuild(build_ext): + build_args += ["--", "/m"] + else: + cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg] +- max_jobs = os.getenv("MAX_JOBS", str(2 * os.cpu_count())) ++ max_jobs = os.getenv("MAX_JOBS", str(len(os.sched_getaffinity(0)))) + build_args += ['-j' + max_jobs] + + if check_env_flag("TRITON_BUILD_WITH_CLANG_LLD"):