From e0b2833b89ecd0eac2c7a0631bceff6a26536589 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Fri, 20 Oct 2023 11:21:37 +0200 Subject: [PATCH 1/2] fix pybind11 incompatibility with some CUDA versions and add Catch2 dependency for tests --- .../easyconfigs/c/Catch2/Catch2-2.13.9.eb | 32 +++++++++++++++++ .../pybind11-2.10.3-GCCcore-12.2.0.eb | 15 ++++++-- .../pybind11-2.10.3_fix-nvcc-compat.patch | 34 +++++++++++++++++++ .../pybind11-2.10.3_require-catch.patch | 21 ++++++++++++ .../pybind11-2.11.1-GCCcore-12.3.0.eb | 12 ++++++- 5 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 easybuild/easyconfigs/c/Catch2/Catch2-2.13.9.eb create mode 100644 easybuild/easyconfigs/p/pybind11/pybind11-2.10.3_fix-nvcc-compat.patch create mode 100644 easybuild/easyconfigs/p/pybind11/pybind11-2.10.3_require-catch.patch diff --git a/easybuild/easyconfigs/c/Catch2/Catch2-2.13.9.eb b/easybuild/easyconfigs/c/Catch2/Catch2-2.13.9.eb new file mode 100644 index 000000000000..23d28166d629 --- /dev/null +++ b/easybuild/easyconfigs/c/Catch2/Catch2-2.13.9.eb @@ -0,0 +1,32 @@ +easyblock = 'CMakeMake' + +name = 'Catch2' +version = '2.13.9' + +homepage = 'https://github.com/catchorg/Catch2' +description = """A modern, C++-native, header-only, + test framework for unit-tests, TDD and BDD + - using C++11, C++14, C++17 and later +""" + +toolchain = SYSTEM + +source_urls = ['https://github.com/catchorg/Catch2/archive/'] +sources = ['v%(version)s.tar.gz'] +checksums = ['06dbc7620e3b96c2b69d57bf337028bf245a211b3cddb843835bfe258f427a52'] + +# using CMake built with GCCcore to avoid relying on the system compiler to build it +builddependencies = [ + ('GCCcore', '10.2.0'), # required to a access CMake when using hierarchical module naming scheme + ('binutils', '2.35', '', ('GCCcore', '10.2.0')), # to make CMake compiler health check pass on old systems + ('CMake', '3.18.4', '', ('GCCcore', '10.2.0')), +] + +separate_build_dir = True + +sanity_check_paths = { + 'files': [], + 'dirs': ['include/catch2', 'lib64/cmake'], +} + +moduleclass = 'lib' diff --git a/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3-GCCcore-12.2.0.eb b/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3-GCCcore-12.2.0.eb index dc6dd0aead44..2438ba933c90 100644 --- a/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3-GCCcore-12.2.0.eb +++ b/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3-GCCcore-12.2.0.eb @@ -9,15 +9,24 @@ toolchain = {'name': 'GCCcore', 'version': '12.2.0'} source_urls = ['https://github.com/pybind/pybind11/archive/'] sources = ['v%(version)s.tar.gz'] -checksums = ['5d8c4c5dda428d3a944ba3d2a5212cb988c2fae4670d58075a5a49075a6ca315'] +patches = [ + 'pybind11-2.10.3_fix-nvcc-compat.patch', + 'pybind11-2.10.3_require-catch.patch', +] +checksums = [ + {'v2.10.3.tar.gz': '5d8c4c5dda428d3a944ba3d2a5212cb988c2fae4670d58075a5a49075a6ca315'}, + {'pybind11-2.10.3_fix-nvcc-compat.patch': '510a23dac47b8b440c06c101d269451c95e09907d9034b6b8a16aeb8b89364ae'}, + {'pybind11-2.10.3_require-catch.patch': '4a27ba3ef1d5c535d120d6178a6e876ae678e4899a07500aab37908357b0b60b'}, +] builddependencies = [ ('binutils', '2.39'), ('CMake', '3.24.3'), + # Test dependencies ('Eigen', '3.4.0'), + ('Catch2', '2.13.9', '', SYSTEM), ] -dependencies = [('Python', '3.10.8')] -configopts = "-DPYTHON_EXECUTABLE=$EBROOTPYTHON/bin/python" +dependencies = [('Python', '3.10.8')] moduleclass = 'lib' diff --git a/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3_fix-nvcc-compat.patch b/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3_fix-nvcc-compat.patch new file mode 100644 index 000000000000..f6f0d60071fb --- /dev/null +++ b/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3_fix-nvcc-compat.patch @@ -0,0 +1,34 @@ +NVCC of CUDA 12 (and seemingly also CUDA 11.7 in some configureations) +fail to parse the expression and fail with +> pybind11/detail/../cast.h: In function ‘typename pybind11::detail::type_caster::type +> ::cast_op_type pybind11::detail::cast_op(make_caster&)’: +> pybind11/detail/../cast.h:45:120: error: expected template-name before ‘<’ token +> 45 | return caster.operator typename make_caster::template cast_op_type(); + +See https://github.com/pybind/pybind11/issues/4606 +Disambiguate the expression to workaround this. + +Author: Alexander Grund (TU Dresden) + +diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h +index 3a404602..1eefd0f1 100644 +--- a/include/pybind11/cast.h ++++ b/include/pybind11/cast.h +@@ -42,13 +42,14 @@ using make_caster = type_caster>; + // Shortcut for calling a caster's `cast_op_type` cast operator for casting a type_caster to a T + template + typename make_caster::template cast_op_type cast_op(make_caster &caster) { +- return caster.operator typename make_caster::template cast_op_type(); ++ using result_t = typename make_caster::template cast_op_type; ++ return caster.operator result_t(); + } + template + typename make_caster::template cast_op_type::type> + cast_op(make_caster &&caster) { +- return std::move(caster).operator typename make_caster:: +- template cast_op_type::type>(); ++ using result_t = typename make_caster::template cast_op_type::type>; ++ return std::move(caster).operator result_t(); + } + + template diff --git a/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3_require-catch.patch b/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3_require-catch.patch new file mode 100644 index 000000000000..dc0b6c18e77f --- /dev/null +++ b/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3_require-catch.patch @@ -0,0 +1,21 @@ +Error out if Catch2 is not found instead of silently skipping. + +Author: Alexander Grund (TU Dresden) + +diff --git a/tools/FindCatch.cmake b/tools/FindCatch.cmake +index 57bba58b..41f82e5c 100644 +--- a/tools/FindCatch.cmake ++++ b/tools/FindCatch.cmake +@@ -60,9 +60,10 @@ if(NOT CATCH_VERSION OR CATCH_VERSION VERSION_LESS ${Catch_FIND_VERSION}) + if(DOWNLOAD_CATCH) + _download_catch(${Catch_FIND_VERSION} "${PROJECT_BINARY_DIR}/catch/") + _get_catch_version() ++ elseif(CATCH_INCLUDE_DIR) ++ message(FATAL_ERROR "Catch (${CATCH_INCLUDE_DIR}) version to low: ${CATCH_VERSION} < ${Catch_FIND_VERSION}") + else() +- set(CATCH_FOUND FALSE) +- return() ++ message(FATAL_ERROR "Catch not found") + endif() + endif() + diff --git a/easybuild/easyconfigs/p/pybind11/pybind11-2.11.1-GCCcore-12.3.0.eb b/easybuild/easyconfigs/p/pybind11/pybind11-2.11.1-GCCcore-12.3.0.eb index b05186f3338c..18a205fd6522 100644 --- a/easybuild/easyconfigs/p/pybind11/pybind11-2.11.1-GCCcore-12.3.0.eb +++ b/easybuild/easyconfigs/p/pybind11/pybind11-2.11.1-GCCcore-12.3.0.eb @@ -9,12 +9,22 @@ toolchain = {'name': 'GCCcore', 'version': '12.3.0'} source_urls = ['https://github.com/pybind/pybind11/archive/'] sources = ['v%(version)s.tar.gz'] -checksums = ['d475978da0cdc2d43b73f30910786759d593a9d8ee05b1b6846d1eb16c6d2e0c'] +patches = [ + 'pybind11-2.10.3_fix-nvcc-compat.patch', + 'pybind11-2.10.3_require-catch.patch', +] +checksums = [ + {'v2.11.1.tar.gz': 'd475978da0cdc2d43b73f30910786759d593a9d8ee05b1b6846d1eb16c6d2e0c'}, + {'pybind11-2.10.3_fix-nvcc-compat.patch': '510a23dac47b8b440c06c101d269451c95e09907d9034b6b8a16aeb8b89364ae'}, + {'pybind11-2.10.3_require-catch.patch': '4a27ba3ef1d5c535d120d6178a6e876ae678e4899a07500aab37908357b0b60b'}, +] builddependencies = [ ('binutils', '2.40'), ('CMake', '3.26.3'), + # Test dependencies ('Eigen', '3.4.0'), + ('Catch2', '2.13.9', '', SYSTEM), ('Python-bundle-PyPI', '2023.06'), # to provide pytest ] dependencies = [ From 005be4a9fc808095eba7fae4ba9dfd68ba691b59 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Fri, 20 Oct 2023 16:47:49 +0200 Subject: [PATCH 2/2] Remove superflous configopts --- .../p/pybind11/pybind11-2.10.3-GCCcore-12.2.0.eb | 1 - .../p/pybind11/pybind11-2.11.1-GCCcore-12.3.0.eb | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3-GCCcore-12.2.0.eb b/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3-GCCcore-12.2.0.eb index 2438ba933c90..d3655ac19285 100644 --- a/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3-GCCcore-12.2.0.eb +++ b/easybuild/easyconfigs/p/pybind11/pybind11-2.10.3-GCCcore-12.2.0.eb @@ -26,7 +26,6 @@ builddependencies = [ ('Eigen', '3.4.0'), ('Catch2', '2.13.9', '', SYSTEM), ] - dependencies = [('Python', '3.10.8')] moduleclass = 'lib' diff --git a/easybuild/easyconfigs/p/pybind11/pybind11-2.11.1-GCCcore-12.3.0.eb b/easybuild/easyconfigs/p/pybind11/pybind11-2.11.1-GCCcore-12.3.0.eb index 18a205fd6522..ef87962e756b 100644 --- a/easybuild/easyconfigs/p/pybind11/pybind11-2.11.1-GCCcore-12.3.0.eb +++ b/easybuild/easyconfigs/p/pybind11/pybind11-2.11.1-GCCcore-12.3.0.eb @@ -27,10 +27,6 @@ builddependencies = [ ('Catch2', '2.13.9', '', SYSTEM), ('Python-bundle-PyPI', '2023.06'), # to provide pytest ] -dependencies = [ - ('Python', '3.11.3'), -] - -configopts = "-DPYTHON_EXECUTABLE=$EBROOTPYTHON/bin/python" +dependencies = [('Python', '3.11.3')] moduleclass = 'lib'