From 9bfdd90e19eb4b58b1eab2c2363801b2baa61cf8 Mon Sep 17 00:00:00 2001 From: Vladislav Mogilev Date: Fri, 5 Dec 2025 17:58:42 +0000 Subject: [PATCH 1/6] build(TreeFARMS): easyconf & patch --- .../TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb | 94 +++++++++++++++++++ .../TreeFARMS-0.2.4_installcli.patch | 56 +++++++++++ 2 files changed, 150 insertions(+) create mode 100644 easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb create mode 100644 easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4_installcli.patch diff --git a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb new file mode 100644 index 00000000..5d061020 --- /dev/null +++ b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb @@ -0,0 +1,94 @@ +easyblock = 'PythonBundle' + +name = 'TreeFARMS' +version = '0.2.4' +_commit = '5508f60' +versionsuffix = '-%s' % _commit + +homepage = 'https://github.com/ubc-systopia/treeFarms' +description = """ +Implementation of Trees FAst RashoMon Sets. +""" + +toolchain = {'name': 'gfbf', 'version': '2024a'} + +builddependencies = [ + ('CMake', '3.31.8'), + ('pkg-config', '0.29.2'), + ('Ninja', '1.12.1'), + ('scikit-build', '0.17.6'), + ('patchelf', '0.18.0'), + ('tbb', '2021.13.0'), + ('GMP', '6.3.0'), + ('nodejs', '20.13.1'), +] + +dependencies = [ + ('Python', '3.12.3'), + ('IPython', '8.28.0'), + ('SciPy-bundle', '2024.05'), + ('scikit-learn', '1.5.2'), + ('matplotlib', '3.9.2'), + ('tqdm', '4.66.5'), + ('gmpy2', '2.2.0'), +] +_date = 'date +%d%m%Y' +_host = 'uname -s' +_buildtype = 'Release' +# _buildtype = 'Debug' +# _buildflags = '-Wall -Wextra -pedantic -fno-canonical-system-headers' +_localcmakesed = ' '.join([ + f'BUILDDATE=$({_date})', + f'BUILDHOST=$({_host}) &&', + "sed -i -e '9s/version/%s/'" % version, + "-e '10s|installdir|%(installdir)s|'", + '-e "11s/builddate/$BUILDDATE/"', + '-e "12s/buildhost/$BUILDHOST/"', + "-e '13s/buildgitrev/%s/'" % _commit, + "-e '14s/buildtype/%s/'" % _buildtype, + "-e '15s/buildflags/%s/'" % _buildflags, + 'setup.py', + '&& ' +]) + +exts_defaultclass = 'PythonPackage' +exts_default_options = { + 'source_urls': [PYPI_SOURCE], + 'download_dep_fail': True, + 'sanity_pip_check': True, +} +exts_list = [ + ('editables', '0.2'), + ('timbertrek', '0.1.7', { + 'checksums': ['83f558ecfb4d8b11a79525cc7846b185803a707455566e638f15dfd26de3084b'], + }), + ('treefarms', version, { + 'patches': [f'{name}-%(version)s_installcli.patch'], + 'preinstallopts': _localcmakesed, + 'postinstallcmds': ["mv %(installdir)s/lib/python%(pyshortver)s/site-packages/" \ + "%(name)s/{bin,experiments,README_PyPI.md,LICENSE} %(installdir)s"], + 'sources': [{ + 'git_config': { + 'url': 'https://github.com/%(github_account)s', + 'repo_name': '%(name)s', # 'TreeFarms', + 'commit': '%s' % _commit, + }, + 'filename': SOURCE_TAR_XZ, + }], + 'checksums': ['fc98ef8bee3cfee0e7338f62e8f41747bccad4294c7c978054961265d3d7aa5a'], + }), +] + +sanity_check_paths = { + 'files': ['bin/%(namelower)s', f'lib/python%(pyshortver)s/site-packages/%(namelower)s/libgosdt.abi3.{SHLIB_EXT}'], + 'dirs': ['experiments', 'lib/python%(pyshortver)s/site-packages'], +} +sanity_check_commands = [ + "%(namelower)s ", + "python -c 'import %(namelower)s'", + "cd %(installdir)s; python lib/python%(pyshortver)s/site-packages/%(namelower)s/example.py", +] + +modextrapaths = {'PYTHONPATH': 'lib/python%(pyshortver)s/site-packages'} + +moduleclass = 'dataset' diff --git a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4_installcli.patch b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4_installcli.patch new file mode 100644 index 00000000..ca05959f --- /dev/null +++ b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4_installcli.patch @@ -0,0 +1,56 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d272cc3..de32f8f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -26,6 +26,8 @@ else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -DDEBUG") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") ++ add_compile_definitions(_VERSION_="${_VERSION_}" BUILD_HOST="${BUILD_HOST}" BUILD_DATE="${BUILD_DATE}" BUILD_GIT_REV="${BUILD_GIT_REV}") ++ add_definitions("${BUILDFLAGS}") + endif() + + # +@@ -77,6 +79,11 @@ find_package(Threads REQUIRED) + target_link_libraries(${TARGET_CLI} PRIVATE Threads::Threads) + target_link_libraries(${TARGET_TESTS} PRIVATE Threads::Threads) + ++install(TARGETS ${TARGET_CLI} RUNTIME DESTINATION bin) ++#install(TARGETS ${TARGET_TESTS} RUNTIME DESTINATION ${EBINSTDIR}/bin) ++install(DIRECTORY ${CMAKE_SOURCE_DIR}/experiments/ DESTINATION experiments) ++install(FILES README_PyPI.md LICENSE DESTINATION .) ++ + # Target: TREEFARMS Python Module + if (SKBUILD) + message(STATUS "TREEFARMS is built using scikit-build. Will build the Python module.") +diff --git a/setup.py b/setup.py +index 09e61d5..444d4e2 100644 +--- a/setup.py ++++ b/setup.py +@@ -6,7 +6,14 @@ import distro + from setuptools import find_packages + from skbuild import setup + +-cmake_args = [] ++cmake_args = ['-D_VERSION_:STRING=version', ++ '-DEBINSTDIR:PATH=installdir', ++ '-DBUILD_DATE:STRING=builddate', ++ '-DBUILD_HOST:STRING=buildhost', ++ '-DBUILD_GIT_REV:STRING=buildgitrev', ++ '-DCMAKE_BUILD_TYPE:STRING=buildtype', ++ '-DBUILDFLAGS=buildflags', ++] + + if platform.system() == "Windows" or (platform.system() == "Linux" and distro.id() == "centos"): + assert "VCPKG_INSTALLATION_ROOT" in os.environ, \ +diff --git a/test/test.cpp b/test/test.cpp +index 179f419..486792d 100644 +--- a/test/test.cpp ++++ b/test/test.cpp +@@ -29,4 +29,4 @@ int main() { + std::cout << "\033[1;31m" << failures << " Tests Failed" << "\033[0m" << std::endl; + return 1; + } +-} +\ No newline at end of file ++} From 4d04c410fc5c9f8f3e7298983d2889b7baa8e1ce Mon Sep 17 00:00:00 2001 From: Vladislav Mogilev Date: Fri, 5 Dec 2025 18:19:06 +0000 Subject: [PATCH 2/6] style(TreeFARMS): linting --- .../TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb index 5d061020..cf5acd7a 100644 --- a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb +++ b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb @@ -35,8 +35,7 @@ dependencies = [ _date = 'date +%d%m%Y' _host = 'uname -s' _buildtype = 'Release' -# _buildtype = 'Debug' -# _buildflags = '-Wall -Wextra -pedantic -fno-canonical-system-headers' +_buildflags = '-O3' _localcmakesed = ' '.join([ f'BUILDDATE=$({_date})', f'BUILDHOST=$({_host}) &&', @@ -58,19 +57,21 @@ exts_default_options = { 'sanity_pip_check': True, } exts_list = [ - ('editables', '0.2'), + ('editables', '0.2', { + 'checksums': ['6918f16225258f24ef9800c2327e14eded42ddac344e77982380749464024f35'], + }), ('timbertrek', '0.1.7', { 'checksums': ['83f558ecfb4d8b11a79525cc7846b185803a707455566e638f15dfd26de3084b'], }), ('treefarms', version, { 'patches': [f'{name}-%(version)s_installcli.patch'], 'preinstallopts': _localcmakesed, - 'postinstallcmds': ["mv %(installdir)s/lib/python%(pyshortver)s/site-packages/" \ + 'postinstallcmds': ["mv %(installdir)s/lib/python%(pyshortver)s/site-packages/\\" "%(name)s/{bin,experiments,README_PyPI.md,LICENSE} %(installdir)s"], - 'sources': [{ + 'sources': [{ 'git_config': { 'url': 'https://github.com/%(github_account)s', - 'repo_name': '%(name)s', # 'TreeFarms', + 'repo_name': '%(name)s', 'commit': '%s' % _commit, }, 'filename': SOURCE_TAR_XZ, From 6e8c9b6a2651eaf5f4555d59cf33dea2988d815a Mon Sep 17 00:00:00 2001 From: Vladislav Mogilev Date: Fri, 5 Dec 2025 18:48:23 +0000 Subject: [PATCH 3/6] refactor: fix patch, checksums & remove unnecessary opts --- .../TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb | 16 ++++++++------- .../TreeFARMS-0.2.4_installcli.patch | 20 ++++--------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb index cf5acd7a..8741f0b2 100644 --- a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb +++ b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb @@ -40,12 +40,11 @@ _localcmakesed = ' '.join([ f'BUILDDATE=$({_date})', f'BUILDHOST=$({_host}) &&', "sed -i -e '9s/version/%s/'" % version, - "-e '10s|installdir|%(installdir)s|'", - '-e "11s/builddate/$BUILDDATE/"', - '-e "12s/buildhost/$BUILDHOST/"', - "-e '13s/buildgitrev/%s/'" % _commit, - "-e '14s/buildtype/%s/'" % _buildtype, - "-e '15s/buildflags/%s/'" % _buildflags, + '-e "10s/builddate/$BUILDDATE/"', + '-e "11s/buildhost/$BUILDHOST/"', + "-e '12s/buildgitrev/%s/'" % _commit, + "-e '13s/buildtype/%s/'" % _buildtype, + "-e '14s/buildflags/%s/'" % _buildflags, 'setup.py', '&& ' ]) @@ -76,7 +75,10 @@ exts_list = [ }, 'filename': SOURCE_TAR_XZ, }], - 'checksums': ['fc98ef8bee3cfee0e7338f62e8f41747bccad4294c7c978054961265d3d7aa5a'], + 'checksums': [ + {'treefarms-0.2.4.tar.xz': 'fc98ef8bee3cfee0e7338f62e8f41747bccad4294c7c978054961265d3d7aa5a'}, + {'TreeFARMS-0.2.4_installcli.patch': '31a62927f5c0c47f8bc3eff3a2d23609e555ac93a8ee0519e0190dcf5f992661'}, + ], }), ] diff --git a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4_installcli.patch b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4_installcli.patch index ca05959f..6a333500 100644 --- a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4_installcli.patch +++ b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4_installcli.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index d272cc3..de32f8f 100644 +index d272cc3..1d22d1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,8 @@ else() @@ -16,7 +16,7 @@ index d272cc3..de32f8f 100644 target_link_libraries(${TARGET_TESTS} PRIVATE Threads::Threads) +install(TARGETS ${TARGET_CLI} RUNTIME DESTINATION bin) -+#install(TARGETS ${TARGET_TESTS} RUNTIME DESTINATION ${EBINSTDIR}/bin) ++#install(TARGETS ${TARGET_TESTS} RUNTIME DESTINATION bin) +install(DIRECTORY ${CMAKE_SOURCE_DIR}/experiments/ DESTINATION experiments) +install(FILES README_PyPI.md LICENSE DESTINATION .) + @@ -24,16 +24,15 @@ index d272cc3..de32f8f 100644 if (SKBUILD) message(STATUS "TREEFARMS is built using scikit-build. Will build the Python module.") diff --git a/setup.py b/setup.py -index 09e61d5..444d4e2 100644 +index 09e61d5..1dc55a3 100644 --- a/setup.py +++ b/setup.py -@@ -6,7 +6,14 @@ import distro +@@ -6,7 +6,13 @@ import distro from setuptools import find_packages from skbuild import setup -cmake_args = [] +cmake_args = ['-D_VERSION_:STRING=version', -+ '-DEBINSTDIR:PATH=installdir', + '-DBUILD_DATE:STRING=builddate', + '-DBUILD_HOST:STRING=buildhost', + '-DBUILD_GIT_REV:STRING=buildgitrev', @@ -43,14 +42,3 @@ index 09e61d5..444d4e2 100644 if platform.system() == "Windows" or (platform.system() == "Linux" and distro.id() == "centos"): assert "VCPKG_INSTALLATION_ROOT" in os.environ, \ -diff --git a/test/test.cpp b/test/test.cpp -index 179f419..486792d 100644 ---- a/test/test.cpp -+++ b/test/test.cpp -@@ -29,4 +29,4 @@ int main() { - std::cout << "\033[1;31m" << failures << " Tests Failed" << "\033[0m" << std::endl; - return 1; - } --} -\ No newline at end of file -+} From d75843afbcd5a29a2f68676eb5234926e759bf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=7CV=7C=E3=81=8F?= <42519156+movlako@users.noreply.github.com> Date: Tue, 13 Jan 2026 15:08:04 +0000 Subject: [PATCH 4/6] Apply suggestion from @orbsmiv Co-authored-by: James Carpenter --- .../t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb index 8741f0b2..a700c8a3 100644 --- a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb +++ b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb @@ -14,13 +14,8 @@ toolchain = {'name': 'gfbf', 'version': '2024a'} builddependencies = [ ('CMake', '3.31.8'), - ('pkg-config', '0.29.2'), - ('Ninja', '1.12.1'), ('scikit-build', '0.17.6'), - ('patchelf', '0.18.0'), - ('tbb', '2021.13.0'), - ('GMP', '6.3.0'), - ('nodejs', '20.13.1'), + ('tbb', '2021.13.0') ] dependencies = [ From 58fd8730c6944385e6dcb9dc45b2f50ba370f360 Mon Sep 17 00:00:00 2001 From: Vladislav Mogilev Date: Tue, 13 Jan 2026 15:28:33 +0000 Subject: [PATCH 5/6] fix(tbb+GMP): parallel runtime libraries --- easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb index a700c8a3..553d9688 100644 --- a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb +++ b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb @@ -15,7 +15,6 @@ toolchain = {'name': 'gfbf', 'version': '2024a'} builddependencies = [ ('CMake', '3.31.8'), ('scikit-build', '0.17.6'), - ('tbb', '2021.13.0') ] dependencies = [ @@ -25,6 +24,8 @@ dependencies = [ ('scikit-learn', '1.5.2'), ('matplotlib', '3.9.2'), ('tqdm', '4.66.5'), + ('tbb', '2021.13.0') + ('GMP', '6.3.0'), ('gmpy2', '2.2.0'), ] _date = 'date +%d%m%Y' From f51aa770638ede4a5be61a386cecc0796ce0132c Mon Sep 17 00:00:00 2001 From: Vladislav Mogilev Date: Wed, 14 Jan 2026 13:37:19 +0000 Subject: [PATCH 6/6] fix(TreeFARMS): comma --- easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb index 553d9688..20867e25 100644 --- a/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb +++ b/easyconfigs/t/TreeFARMS/TreeFARMS-0.2.4-gfbf-2024a-5508f60.eb @@ -24,7 +24,7 @@ dependencies = [ ('scikit-learn', '1.5.2'), ('matplotlib', '3.9.2'), ('tqdm', '4.66.5'), - ('tbb', '2021.13.0') + ('tbb', '2021.13.0'), ('GMP', '6.3.0'), ('gmpy2', '2.2.0'), ]