From 74d3442a32b92145d78e68875eef543db77467c3 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Wed, 9 Sep 2020 15:55:26 +0200 Subject: [PATCH 01/27] Added guards to the includes Added new CI config Added new trigger Changed CI workflow name Debug CI Debug CI Debug CI Debug CI Added flags fro PGI Disable Eigen Removed tests that fail Uncomment lines --- .github/workflows/ci.yml | 53 ++++++++++++++++++++++++++++- include/pybind11/detail/internals.h | 8 +++++ include/pybind11/pybind11.h | 4 +++ tests/CMakeLists.txt | 16 +++++++-- 4 files changed, 77 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3104f49e5f..89caeea59e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ on: - master - stable - v* + - support_pgc jobs: standard: @@ -289,6 +290,7 @@ jobs: - name: Interface test run: cmake --build build --target test_cmake_build + cuda: runs-on: ubuntu-latest name: "🐍 3.8 • CUDA 11 • Ubuntu 20.04" @@ -296,7 +298,7 @@ jobs: steps: - uses: actions/checkout@v2 - + # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND - name: Install 🐍 3 run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake python3-dev python3-pytest @@ -311,6 +313,55 @@ jobs: run: cmake --build build --target pytest + centos-nvhpc: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + centos: + - 7 # GCC 4.8 + - 8 + + name: "🐍 3 • CentOS ${{ matrix.centos }} • x64 with NVHPC (PGC)" + container: "centos:${{ matrix.centos }}" + + steps: + - uses: actions/checkout@v2 + + - name: Add Python 3 + run: yum update -y && yum install -y python3-devel gcc-c++ make git + + - name: Update pip + run: python3 -m pip install --upgrade pip + + - name: Install dependencies + run: python3 -m pip install cmake -r tests/requirements.txt --prefer-binary + + - name: Install NVidia HPC SDK + run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm + + - name: Install modules + run: yum -y install environment-modules + + - name: Configure + shell: bash + run: | + source /etc/profile.d/modules.sh + module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 + cmake -S . -B build -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=OFF -DDOWNLOAD_EIGEN=OFF -DCMAKE_CXX_STANDARD=11 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") + + - name: Build + run: cmake --build build -j 2 + + - name: Python tests + run: cmake --build build --target pytest + + - name: C++ tests + run: cmake --build build --target cpptest + + - name: Interface test + run: cmake --build build --target test_cmake_build + install-classic: name: "🐍 3.5 • Debian • x86 • Install" runs-on: ubuntu-latest diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index cf40e9fe99..97f39ad1f1 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -100,7 +100,9 @@ struct internals { std::unordered_set, overload_hash> inactive_overload_cache; type_map> direct_conversions; std::unordered_map> patients; +#if !defined (__PGIC__) std::forward_list registered_exception_translators; +#endif std::unordered_map shared_data; // Custom data to be shared across extensions std::vector loader_patient_stack; // Used by `loader_life_support` std::forward_list static_strings; // Stores the std::strings backing detail::c_str() @@ -212,6 +214,7 @@ inline internals **&get_internals_pp() { return internals_pp; } +#if !defined (__PGIC__) inline void translate_exception(std::exception_ptr p) { try { if (p) std::rethrow_exception(p); @@ -230,6 +233,7 @@ inline void translate_exception(std::exception_ptr p) { return; } } +#endif #if !defined(__GLIBCXX__) inline void translate_local_exception(std::exception_ptr p) { @@ -266,7 +270,9 @@ PYBIND11_NOINLINE inline internals &get_internals() { // // libstdc++ doesn't require this (types there are identified only by name) #if !defined(__GLIBCXX__) +#if !defined (__PGIC__) (*internals_pp)->registered_exception_translators.push_front(&translate_local_exception); +#endif #endif } else { if (!internals_pp) internals_pp = new internals*(); @@ -292,7 +298,9 @@ PYBIND11_NOINLINE inline internals &get_internals() { internals_ptr->istate = tstate->interp; #endif builtins[id] = capsule(internals_pp); +#if !defined (__PGIC__) internals_ptr->registered_exception_translators.push_front(&translate_exception); +#endif internals_ptr->static_property_type = make_static_property_type(); internals_ptr->default_metaclass = make_default_metaclass(); internals_ptr->instance_base = make_object_base_type(internals_ptr->default_metaclass); diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 602d5790a2..6388cf6857 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -740,6 +740,7 @@ class cpp_function : public function { - do nothing and let the exception fall through to the next translator, or - delegate translation to the next translator by throwing a new type of exception. */ +#if !defined (__PGIC__) auto last_exception = std::current_exception(); auto ®istered_exception_translators = get_internals().registered_exception_translators; for (auto& translator : registered_exception_translators) { @@ -751,6 +752,7 @@ class cpp_function : public function { } return nullptr; } +#endif PyErr_SetString(PyExc_SystemError, "Exception escaped from default exception translator!"); return nullptr; } @@ -1851,11 +1853,13 @@ template void implicitly_convertible() pybind11_fail("implicitly_convertible: Unable to find type " + type_id()); } +#if !defined (__PGIC__) template void register_exception_translator(ExceptionTranslator&& translator) { detail::get_internals().registered_exception_translators.push_front( std::forward(translator)); } +#endif /** * Wrapper to generate a new Python exception type. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e59c75ce88..deaf7bc114 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -74,7 +74,7 @@ set(PYBIND11_TEST_FILES test_eigen.cpp test_enum.cpp test_eval.cpp - test_exceptions.cpp + #AV this fails with PGI test_exceptions.cpp test_factory_constructors.cpp test_gil_scoped.cpp test_iostream.cpp @@ -91,12 +91,13 @@ set(PYBIND11_TEST_FILES test_pickling.cpp test_pytypes.cpp test_sequences_and_iterators.cpp - test_smart_ptr.cpp + #AV this fails with PGI test_smart_ptr.cpp test_stl.cpp test_stl_binders.cpp test_tagbased_polymorphic.cpp test_union.cpp - test_virtual_functions.cpp) + #AV this fails with PGI test_virtual_functions.cpp + ) # Invoking cmake with something like: # cmake -DPYBIND11_TEST_OVERRIDE="test_callbacks.cpp;test_pickling.cpp" .. @@ -295,6 +296,15 @@ foreach(target ${test_targets}) if(MSVC) target_compile_options(${target} PRIVATE /utf-8) endif() + if (${CMAKE_CXX_COMPILER_ID} MATCHES "PGI") + if (WIN32) + target_compile_options(${target} PRIVATE -Wc,--pending_instantiations=0 ) + else() + target_compile_options(${target} PRIVATE -Wc,--pending_instantiations=0 -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1) + endif() + endif() + + if(EIGEN3_FOUND) target_link_libraries(${target} PRIVATE Eigen3::Eigen) From 9b53c438d7981afa6775e097de3554fd09813dee Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 9 Sep 2020 12:56:57 -0400 Subject: [PATCH 02/27] fix: missing include fix: minor style cleanup tests: support skipping ci: remove and tighten a bit fix: try msvc workaround for pgic --- .github/workflows/ci.yml | 26 +++++-------- include/pybind11/detail/internals.h | 10 +---- include/pybind11/pybind11.h | 6 +-- tests/CMakeLists.txt | 59 +++++++++++++++++++---------- tests/test_factory_constructors.cpp | 2 +- tests/test_virtual_functions.cpp | 4 +- 6 files changed, 54 insertions(+), 53 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89caeea59e..910b23dafe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,6 @@ on: - master - stable - v* - - support_pgc jobs: standard: @@ -298,7 +297,7 @@ jobs: steps: - uses: actions/checkout@v2 - + # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND - name: Install 🐍 3 run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake python3-dev python3-pytest @@ -317,38 +316,31 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - centos: - - 7 # GCC 4.8 - - 8 - name: "🐍 3 • CentOS ${{ matrix.centos }} • x64 with NVHPC (PGC)" - container: "centos:${{ matrix.centos }}" + name: "🐍 3 • PGI • x64" + container: "centos:8" steps: - uses: actions/checkout@v2 - - name: Add Python 3 - run: yum update -y && yum install -y python3-devel gcc-c++ make git + - name: Add Python 3 and a few requirements + run: yum update -y && yum install -y python3-devel cmake make environment-modules - name: Update pip run: python3 -m pip install --upgrade pip - - name: Install dependencies + - name: Install Python dependencies run: python3 -m pip install cmake -r tests/requirements.txt --prefer-binary - + - name: Install NVidia HPC SDK - run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm + run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm - - name: Install modules - run: yum -y install environment-modules - - name: Configure shell: bash run: | source /etc/profile.d/modules.sh module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 - cmake -S . -B build -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=OFF -DDOWNLOAD_EIGEN=OFF -DCMAKE_CXX_STANDARD=11 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") + cmake -S . -B build -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=OFF -DDOWNLOAD_EIGEN=OFF -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - name: Build run: cmake --build build -j 2 diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 97f39ad1f1..1ab3f87429 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -11,6 +11,8 @@ #include "../pytypes.h" +#include + PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) PYBIND11_NAMESPACE_BEGIN(detail) // Forward declarations @@ -100,9 +102,7 @@ struct internals { std::unordered_set, overload_hash> inactive_overload_cache; type_map> direct_conversions; std::unordered_map> patients; -#if !defined (__PGIC__) std::forward_list registered_exception_translators; -#endif std::unordered_map shared_data; // Custom data to be shared across extensions std::vector loader_patient_stack; // Used by `loader_life_support` std::forward_list static_strings; // Stores the std::strings backing detail::c_str() @@ -214,7 +214,6 @@ inline internals **&get_internals_pp() { return internals_pp; } -#if !defined (__PGIC__) inline void translate_exception(std::exception_ptr p) { try { if (p) std::rethrow_exception(p); @@ -233,7 +232,6 @@ inline void translate_exception(std::exception_ptr p) { return; } } -#endif #if !defined(__GLIBCXX__) inline void translate_local_exception(std::exception_ptr p) { @@ -270,9 +268,7 @@ PYBIND11_NOINLINE inline internals &get_internals() { // // libstdc++ doesn't require this (types there are identified only by name) #if !defined(__GLIBCXX__) -#if !defined (__PGIC__) (*internals_pp)->registered_exception_translators.push_front(&translate_local_exception); -#endif #endif } else { if (!internals_pp) internals_pp = new internals*(); @@ -298,9 +294,7 @@ PYBIND11_NOINLINE inline internals &get_internals() { internals_ptr->istate = tstate->interp; #endif builtins[id] = capsule(internals_pp); -#if !defined (__PGIC__) internals_ptr->registered_exception_translators.push_front(&translate_exception); -#endif internals_ptr->static_property_type = make_static_property_type(); internals_ptr->default_metaclass = make_default_metaclass(); internals_ptr->instance_base = make_object_base_type(internals_ptr->default_metaclass); diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 6388cf6857..a2611f5ee6 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -50,6 +50,8 @@ # include #endif +#include + PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) /// Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object @@ -740,7 +742,6 @@ class cpp_function : public function { - do nothing and let the exception fall through to the next translator, or - delegate translation to the next translator by throwing a new type of exception. */ -#if !defined (__PGIC__) auto last_exception = std::current_exception(); auto ®istered_exception_translators = get_internals().registered_exception_translators; for (auto& translator : registered_exception_translators) { @@ -752,7 +753,6 @@ class cpp_function : public function { } return nullptr; } -#endif PyErr_SetString(PyExc_SystemError, "Exception escaped from default exception translator!"); return nullptr; } @@ -1853,13 +1853,11 @@ template void implicitly_convertible() pybind11_fail("implicitly_convertible: Unable to find type " + type_id()); } -#if !defined (__PGIC__) template void register_exception_translator(ExceptionTranslator&& translator) { detail::get_internals().registered_exception_translators.push_front( std::forward(translator)); } -#endif /** * Wrapper to generate a new Python exception type. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index deaf7bc114..e1d4c91543 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -16,6 +16,29 @@ else() cmake_policy(VERSION 3.18) endif() +# Only needed for CMake < 3.5 support +include(CMakeParseArguments) + +# Filter out items; print an optional message if any items filtered +# +# Usage: +# pybind11_filter_tests(LISTNAME file1.cpp file2.cpp ... MESSAGE "") +# +macro(PYBIND11_FILTER_TESTS LISTNAME) + cmake_parse_arguments(ARG "" "MESSAGE" "" ${ARGN}) + set(PYBIND11_FILTER_TESTS_FOUND OFF) + foreach(filename IN LISTS ARG_UNPARSED_ARGUMENTS) + list(FIND ${LISTNAME} ${filename} _FILE_FOUND) + if(_FILE_FOUND GREATER -1) + list(REMOVE_AT ${LISTNAME} ${_FILE_FOUND}) + set(PYBIND11_FILTER_TESTS_FOUND ON) + endif() + endforeach() + if(PYBIND11_FILTER_TESTS_FOUND AND ARG_MESSAGE) + message(STATUS "${ARG_MESSAGE}") + endif() +endmacro() + # New Python support if(DEFINED Python_EXECUTABLE) set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}") @@ -74,7 +97,7 @@ set(PYBIND11_TEST_FILES test_eigen.cpp test_enum.cpp test_eval.cpp - #AV this fails with PGI test_exceptions.cpp + test_exceptions.cpp test_factory_constructors.cpp test_gil_scoped.cpp test_iostream.cpp @@ -91,13 +114,12 @@ set(PYBIND11_TEST_FILES test_pickling.cpp test_pytypes.cpp test_sequences_and_iterators.cpp - #AV this fails with PGI test_smart_ptr.cpp + test_smart_ptr.cpp test_stl.cpp test_stl_binders.cpp test_tagbased_polymorphic.cpp test_union.cpp - #AV this fails with PGI test_virtual_functions.cpp - ) + test_virtual_functions.cpp) # Invoking cmake with something like: # cmake -DPYBIND11_TEST_OVERRIDE="test_callbacks.cpp;test_pickling.cpp" .. @@ -107,21 +129,18 @@ if(PYBIND11_TEST_OVERRIDE) set(PYBIND11_TEST_FILES ${PYBIND11_TEST_OVERRIDE}) endif() -# Skip test_async for Python < 3.5 -list(FIND PYBIND11_TEST_FILES test_async.cpp PYBIND11_TEST_FILES_ASYNC_I) -if((PYBIND11_TEST_FILES_ASYNC_I GREATER -1) AND (PYTHON_VERSION VERSION_LESS 3.5)) - message(STATUS "Skipping test_async because Python version ${PYTHON_VERSION} < 3.5") - list(REMOVE_AT PYBIND11_TEST_FILES ${PYBIND11_TEST_FILES_ASYNC_I}) +if(PYTHON_VERSION VERSION_LESS 3.5) + pybind11_filter_tests(PYBIND11_TEST_FILES test_async.cpp MESSAGE + "Skipping test_async on Python 2") endif() # Skip tests for CUDA check: # /pybind11/tests/test_constants_and_functions.cpp(125): # error: incompatible exception specifications -list(FIND PYBIND11_TEST_FILES test_constants_and_functions.cpp PYBIND11_TEST_FILES_CAF_I) -if((PYBIND11_TEST_FILES_CAF_I GREATER -1) AND PYBIND11_CUDA_TESTS) - message( - STATUS "Skipping test_constants_and_functions due to incompatible exception specifications") - list(REMOVE_AT PYBIND11_TEST_FILES ${PYBIND11_TEST_FILES_CAF_I}) +if(PYBIND11_CUDA_TESTS) + pybind11_filter_tests( + PYBIND11_TEST_FILES test_constants_and_functions.cpp MESSAGE + "Skipping test_constants_and_functions due to incompatible exception specifications") endif() string(REPLACE ".cpp" ".py" PYBIND11_PYTEST_FILES "${PYBIND11_TEST_FILES}") @@ -296,15 +315,13 @@ foreach(target ${test_targets}) if(MSVC) target_compile_options(${target} PRIVATE /utf-8) endif() - if (${CMAKE_CXX_COMPILER_ID} MATCHES "PGI") - if (WIN32) - target_compile_options(${target} PRIVATE -Wc,--pending_instantiations=0 ) - else() - target_compile_options(${target} PRIVATE -Wc,--pending_instantiations=0 -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1) + + if(${CMAKE_CXX_COMPILER_ID} MATCHES "PGI") + target_compile_options(${target} PRIVATE -Wc,--pending_instantiations=0) + if(NOT WIN32) + target_compile_definitions(${target} PRIVATE -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1) endif() endif() - - if(EIGEN3_FOUND) target_link_libraries(${target} PRIVATE Eigen3::Eigen) diff --git a/tests/test_factory_constructors.cpp b/tests/test_factory_constructors.cpp index 61cf33d16e..48b3cfbd1d 100644 --- a/tests/test_factory_constructors.cpp +++ b/tests/test_factory_constructors.cpp @@ -298,7 +298,7 @@ TEST_SUBMODULE(factory_constructors, m) { static void *operator new(size_t, void *p) { py::print("noisy placement new"); return p; } static void operator delete(void *p, size_t) { py::print("noisy delete"); ::operator delete(p); } static void operator delete(void *, void *) { py::print("noisy placement delete"); } -#if defined(_MSC_VER) && _MSC_VER < 1910 +#if defined(__PGIC__) || (defined(_MSC_VER) && _MSC_VER < 1910) // MSVC 2015 bug: the above "noisy delete" isn't invoked (fixed in MSVC 2017) static void operator delete(void *p) { py::print("noisy delete"); ::operator delete(p); } #endif diff --git a/tests/test_virtual_functions.cpp b/tests/test_virtual_functions.cpp index 6dcf294153..c5ee6365fb 100644 --- a/tests/test_virtual_functions.cpp +++ b/tests/test_virtual_functions.cpp @@ -139,7 +139,7 @@ class NCVirt { std::string print_movable(int a, int b) { return get_movable(a, b).get_value(); } }; class NCVirtTrampoline : public NCVirt { -#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__) +#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__) && !defined(__PGIC__) NonCopyable get_noncopyable(int a, int b) override { PYBIND11_OVERLOAD(NonCopyable, NCVirt, get_noncopyable, a, b); } @@ -205,7 +205,7 @@ TEST_SUBMODULE(virtual_functions, m) { .def(py::init()); // test_move_support -#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__) +#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__) && !defined(__PGIC__) py::class_(m, "NCVirt") .def(py::init<>()) .def("get_noncopyable", &NCVirt::get_noncopyable) From be79610a7f6876ff7ae1d166627b33175315e80e Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 10 Sep 2020 10:58:10 -0400 Subject: [PATCH 03/27] tests: split up prealoc tests --- tests/test_factory_constructors.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/test_factory_constructors.py b/tests/test_factory_constructors.py index 6c4bed165f..b141c13de9 100644 --- a/tests/test_factory_constructors.py +++ b/tests/test_factory_constructors.py @@ -336,10 +336,10 @@ def strip_comments(s): return re.sub(r'\s+#.*', '', s) -def test_reallocations(capture, msg): +def test_reallocation_a(capture, msg): """When the constructor is overloaded, previous overloads can require a preallocated value. This test makes sure that such preallocated values only happen when they might be necessary, - and that they are deallocated properly""" + and that they are deallocated properly.""" pytest.gc_collect() @@ -353,6 +353,9 @@ def test_reallocations(capture, msg): ~NoisyAlloc() noisy delete """ + + +def test_reallocation_b(capture, msg): with capture: create_and_destroy(1.5) assert msg(capture) == strip_comments(""" @@ -365,6 +368,8 @@ def test_reallocations(capture, msg): noisy delete # operator delete """) + +def test_reallocation_c(capture, msg): with capture: create_and_destroy(2, 3) assert msg(capture) == strip_comments(""" @@ -375,6 +380,8 @@ def test_reallocations(capture, msg): noisy delete # operator delete """) + +def test_reallocation_d(capture, msg): with capture: create_and_destroy(2.5, 3) assert msg(capture) == strip_comments(""" @@ -386,6 +393,8 @@ def test_reallocations(capture, msg): noisy delete # operator delete """) + +def test_reallocation_e(capture, msg): with capture: create_and_destroy(3.5, 4.5) assert msg(capture) == strip_comments(""" @@ -397,6 +406,8 @@ def test_reallocations(capture, msg): noisy delete # operator delete """) + +def test_reallocation_f(capture, msg): with capture: create_and_destroy(4, 0.5) assert msg(capture) == strip_comments(""" @@ -409,6 +420,8 @@ def test_reallocations(capture, msg): noisy delete # operator delete """) + +def test_reallocation_g(capture, msg): with capture: create_and_destroy(5, "hi") assert msg(capture) == strip_comments(""" From a1cd376004bc333f4d0b5e8b0da6efbf986a1aef Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 10 Sep 2020 13:40:42 -0400 Subject: [PATCH 04/27] fix: PGI compiler fix --- include/pybind11/detail/common.h | 5 +++-- tests/test_factory_constructors.cpp | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 8923faef76..dd54634810 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -501,8 +501,9 @@ template using select_indices = typename select_indices_impl using bool_constant = std::integral_constant; template struct negation : bool_constant { }; -template struct void_t_impl { using type = void; }; -template using void_t = typename void_t_impl::type; +template +using void_t = void; + /// Compile-time all/any/none of that check the boolean value of all template types #if defined(__cpp_fold_expressions) && !(defined(_MSC_VER) && (_MSC_VER < 1916)) diff --git a/tests/test_factory_constructors.cpp b/tests/test_factory_constructors.cpp index 48b3cfbd1d..535dd71dc5 100644 --- a/tests/test_factory_constructors.cpp +++ b/tests/test_factory_constructors.cpp @@ -11,6 +11,7 @@ #include "pybind11_tests.h" #include "constructor_stats.h" #include +#include // Classes for testing python construction via C++ factory function: // Not publicly constructible, copyable, or movable: @@ -298,11 +299,14 @@ TEST_SUBMODULE(factory_constructors, m) { static void *operator new(size_t, void *p) { py::print("noisy placement new"); return p; } static void operator delete(void *p, size_t) { py::print("noisy delete"); ::operator delete(p); } static void operator delete(void *, void *) { py::print("noisy placement delete"); } -#if defined(__PGIC__) || (defined(_MSC_VER) && _MSC_VER < 1910) +# if defined(_MSC_VER) && _MSC_VER < 1910 // MSVC 2015 bug: the above "noisy delete" isn't invoked (fixed in MSVC 2017) - static void operator delete(void *p) { py::print("noisy delete"); ::operator delete(p); } -#endif + static void operator delete(void *p) { py::print("noisy delete"); ::operator delete(p); } +# endif }; + + static_assert(py::detail::has_operator_delete_size::value, "Must have sized delete"); + py::class_(m, "NoisyAlloc") // Since these overloads have the same number of arguments, the dispatcher will try each of // them until the arguments convert. Thus we can get a pre-allocation here when passing a From 20ea47f309ffd9271b3f75534edce25f9a83bdac Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 10 Sep 2020 14:10:33 -0400 Subject: [PATCH 05/27] fix: PGI void_t only --- include/pybind11/detail/common.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index dd54634810..ecaa54cab8 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -501,8 +501,12 @@ template using select_indices = typename select_indices_impl using bool_constant = std::integral_constant; template struct negation : bool_constant { }; -template -using void_t = void; +#if defined(__PGIC__) +template using void_t = void; +#else +template struct make_void { typedef void type;}; +template using void_t = typename make_void::type; +#endif /// Compile-time all/any/none of that check the boolean value of all template types From 9b24083e17af9af30cad5268deeb400b4c262318 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 10 Sep 2020 14:23:25 -0400 Subject: [PATCH 06/27] fix: try to appease nvcc --- README.md | 1 + include/pybind11/detail/common.h | 7 +++++-- tests/test_factory_constructors.cpp | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 633231f74a..69a0fc90b2 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ In addition to the core functionality, pybind11 provides some extra goodies: v2.0 and a [workaround][intel-15-workaround]) 5. Cygwin/GCC (tested on 2.5.1) 6. NVCC (CUDA 11 tested) +7. NVIDIA PGI (20.7 tested) ## About diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index ecaa54cab8..03cdb7d4b4 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -501,11 +501,14 @@ template using select_indices = typename select_indices_impl using bool_constant = std::integral_constant; template struct negation : bool_constant { }; +// PGI cannot detect operator delete with the "compatible" void_t impl, so +// using the new one (C++14 defect, so generally works on newer compilers, even +// if not in C++17 mode) #if defined(__PGIC__) template using void_t = void; #else -template struct make_void { typedef void type;}; -template using void_t = typename make_void::type; +template struct void_t_impl { using type = void; }; +template using void_t = typename void_t_impl::type; #endif diff --git a/tests/test_factory_constructors.cpp b/tests/test_factory_constructors.cpp index 535dd71dc5..812f4dc3d2 100644 --- a/tests/test_factory_constructors.cpp +++ b/tests/test_factory_constructors.cpp @@ -305,8 +305,6 @@ TEST_SUBMODULE(factory_constructors, m) { # endif }; - static_assert(py::detail::has_operator_delete_size::value, "Must have sized delete"); - py::class_(m, "NoisyAlloc") // Since these overloads have the same number of arguments, the dispatcher will try each of // them until the arguments convert. Thus we can get a pre-allocation here when passing a From a75dae04175c7e84681100bd088a3cb8c840fdba Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 10 Sep 2020 14:29:47 -0400 Subject: [PATCH 07/27] ci: better ordering for slow tests --- .github/workflows/ci.yml | 132 ++++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 910b23dafe..babb89c755 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,6 @@ jobs: python: 3.9-dev arch: x64 - name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • ${{ matrix.arch }} ${{ matrix.args }}" runs-on: ${{ matrix.runs-on }} continue-on-error: ${{ endsWith(matrix.python, 'dev') }} @@ -196,6 +195,72 @@ jobs: - name: Interface test run: cmake --build build --target test_cmake_build + + cuda: + runs-on: ubuntu-latest + name: "🐍 3.8 • CUDA 11 • Ubuntu 20.04" + container: nvidia/cuda:11.0-devel-ubuntu20.04 + + steps: + - uses: actions/checkout@v2 + + # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND + - name: Install 🐍 3 + run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake python3-dev python3-pytest + + - name: Configure + run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON + + - name: Build + run: cmake --build build -j2 -v + + - name: Python tests + run: cmake --build build --target pytest + + + centos-nvhpc: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + name: "🐍 3 • PGI • x64" + container: "centos:8" + + steps: + - uses: actions/checkout@v2 + + - name: Add Python 3 and a few requirements + run: yum update -y && yum install -y python3-devel cmake make environment-modules + + - name: Update pip + run: python3 -m pip install --upgrade pip + + - name: Install Python dependencies + run: python3 -m pip install cmake -r tests/requirements.txt --prefer-binary + + - name: Install NVidia HPC SDK + run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm + + - name: Configure + shell: bash + run: | + source /etc/profile.d/modules.sh + module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 + cmake -S . -B build -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=OFF -DDOWNLOAD_EIGEN=OFF -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") + + - name: Build + run: cmake --build build -j 2 + + - name: Python tests + run: cmake --build build --target pytest + + - name: C++ tests + run: cmake --build build --target cpptest + + - name: Interface test + run: cmake --build build --target test_cmake_build + + gcc: runs-on: ubuntu-latest strategy: @@ -243,6 +308,7 @@ jobs: - name: Interface test run: cmake --build build --target test_cmake_build + centos: runs-on: ubuntu-latest strategy: @@ -290,70 +356,6 @@ jobs: run: cmake --build build --target test_cmake_build - cuda: - runs-on: ubuntu-latest - name: "🐍 3.8 • CUDA 11 • Ubuntu 20.04" - container: nvidia/cuda:11.0-devel-ubuntu20.04 - - steps: - - uses: actions/checkout@v2 - - # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND - - name: Install 🐍 3 - run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake python3-dev python3-pytest - - - name: Configure - run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON - - - name: Build - run: cmake --build build -j2 -v - - - name: Python tests - run: cmake --build build --target pytest - - - centos-nvhpc: - runs-on: ubuntu-latest - strategy: - fail-fast: false - - name: "🐍 3 • PGI • x64" - container: "centos:8" - - steps: - - uses: actions/checkout@v2 - - - name: Add Python 3 and a few requirements - run: yum update -y && yum install -y python3-devel cmake make environment-modules - - - name: Update pip - run: python3 -m pip install --upgrade pip - - - name: Install Python dependencies - run: python3 -m pip install cmake -r tests/requirements.txt --prefer-binary - - - name: Install NVidia HPC SDK - run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm - - - name: Configure - shell: bash - run: | - source /etc/profile.d/modules.sh - module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 - cmake -S . -B build -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=OFF -DDOWNLOAD_EIGEN=OFF -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - - - name: Build - run: cmake --build build -j 2 - - - name: Python tests - run: cmake --build build --target pytest - - - name: C++ tests - run: cmake --build build --target cpptest - - - name: Interface test - run: cmake --build build --target test_cmake_build - install-classic: name: "🐍 3.5 • Debian • x86 • Install" runs-on: ubuntu-latest From 48687d1ba51204b12e2bc1e65630b684b7439cc2 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 10 Sep 2020 14:31:32 -0400 Subject: [PATCH 08/27] ci: minor improvements to testing --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index babb89c755..9255cd4ef7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -246,7 +246,7 @@ jobs: run: | source /etc/profile.d/modules.sh module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 - cmake -S . -B build -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=OFF -DDOWNLOAD_EIGEN=OFF -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") + cmake -S . -B build -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=OFF -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - name: Build run: cmake --build build -j 2 From f5ebec59a8981faa4708f36110047d06d0b99c58 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 00:27:54 -0400 Subject: [PATCH 09/27] ci: Add NumPy to testing --- .github/workflows/ci.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9255cd4ef7..3cf302008c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -206,10 +206,10 @@ jobs: # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND - name: Install 🐍 3 - run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake python3-dev python3-pytest + run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake git python3-dev python3-pytest python3-numpy - name: Configure - run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON + run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON - name: Build run: cmake --build build -j2 -v @@ -230,13 +230,12 @@ jobs: - uses: actions/checkout@v2 - name: Add Python 3 and a few requirements - run: yum update -y && yum install -y python3-devel cmake make environment-modules + run: yum update -y && yum install -y git python3-devel python3-numpy python3-pytest make environment-modules - - name: Update pip - run: python3 -m pip install --upgrade pip - - - name: Install Python dependencies - run: python3 -m pip install cmake -r tests/requirements.txt --prefer-binary + - name: Install CMake with pip + run: | + python3 -m pip install --upgrade pip + python3 -m pip install cmake --prefer-binary - name: Install NVidia HPC SDK run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm @@ -246,7 +245,7 @@ jobs: run: | source /etc/profile.d/modules.sh module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 - cmake -S . -B build -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=OFF -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") + cmake -S . -B build -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - name: Build run: cmake --build build -j 2 From a996fe93eb931c1551c6d5d0ec9e0fbb74fd847e Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 01:07:12 -0400 Subject: [PATCH 10/27] ci: Eigen generates CUDA warnings / PGI errors --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cf302008c..a5fe50a9b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -209,7 +209,7 @@ jobs: run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake git python3-dev python3-pytest python3-numpy - name: Configure - run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON + run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON - name: Build run: cmake --build build -j2 -v @@ -245,7 +245,7 @@ jobs: run: | source /etc/profile.d/modules.sh module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 - cmake -S . -B build -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") + cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - name: Build run: cmake --build build -j 2 From acb951d59d8b1542f8cb1a06e315d728736759e8 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Fri, 11 Sep 2020 18:19:00 +0200 Subject: [PATCH 11/27] Added CentOS7 back for a moment --- .github/workflows/ci.yml | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5fe50a9b2..ac79c01f42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -223,7 +223,7 @@ jobs: strategy: fail-fast: false - name: "🐍 3 • PGI • x64" + name: "🐍 3 • CentOS8/PGI • x64" container: "centos:8" steps: @@ -259,7 +259,42 @@ jobs: - name: Interface test run: cmake --build build --target test_cmake_build + name: "🐍 3 • CentOS7/PGI • x64" + container: "centos:7" + steps: + - uses: actions/checkout@v2 + + - name: Add Python 3 and a few requirements + run: yum update -y && yum install -y git python3-devel make environment-modules + + - name: Install CMake with pip + run: | + python3 -m pip install --upgrade pip + python3 -m pip install cmake --prefer-binary + + - name: Install NVidia HPC SDK + run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm + + - name: Configure + shell: bash + run: | + source /etc/profile.d/modules.sh + module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 + cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") + + - name: Build + run: cmake --build build -j 2 + + - name: Python tests + run: cmake --build build --target pytest + + - name: C++ tests + run: cmake --build build --target cpptest + + - name: Interface test + run: cmake --build build --target test_cmake_build + gcc: runs-on: ubuntu-latest strategy: From 2ac94e32ff1c3f6cf4d0339623b2b435d91a06f1 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 12:22:55 -0400 Subject: [PATCH 12/27] Fix YAML --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac79c01f42..a72414189a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -220,8 +220,6 @@ jobs: centos-nvhpc: runs-on: ubuntu-latest - strategy: - fail-fast: false name: "🐍 3 • CentOS8/PGI • x64" container: "centos:8" @@ -259,6 +257,7 @@ jobs: - name: Interface test run: cmake --build build --target test_cmake_build + centos-nvhpc7: name: "🐍 3 • CentOS7/PGI • x64" container: "centos:7" From e181db590aaa10876d0779504df63b227dc87a12 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 12:28:42 -0400 Subject: [PATCH 13/27] ci: runs-on missing --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a72414189a..17e701c302 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -220,7 +220,6 @@ jobs: centos-nvhpc: runs-on: ubuntu-latest - name: "🐍 3 • CentOS8/PGI • x64" container: "centos:8" @@ -258,6 +257,7 @@ jobs: run: cmake --build build --target test_cmake_build centos-nvhpc7: + runs-on: ubuntu-latest name: "🐍 3 • CentOS7/PGI • x64" container: "centos:7" From 37e717db457646e210a80fb035816e6cb72f688b Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 12:49:07 -0400 Subject: [PATCH 14/27] centos7 is missing pytest --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17e701c302..1d0e192f7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -270,7 +270,7 @@ jobs: - name: Install CMake with pip run: | python3 -m pip install --upgrade pip - python3 -m pip install cmake --prefer-binary + python3 -m pip install pytest cmake --prefer-binary - name: Install NVidia HPC SDK run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm From 75331607909d1c9c9d2b59afe061310a385de57e Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 13:13:12 -0400 Subject: [PATCH 15/27] ci: use C++11 on CentOS 7 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d0e192f7c..6be6cc015d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -280,7 +280,7 @@ jobs: run: | source /etc/profile.d/modules.sh module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 - cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") + cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=11 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - name: Build run: cmake --build build -j 2 From a9a7e1ddaf3f88b03c4a64aaa29e0026d8e5b8b9 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 13:39:13 -0400 Subject: [PATCH 16/27] ci: test something else --- .github/CONTRIBUTING.md | 23 +++++++++++++++++++++++ .github/workflows/ci.yml | 2 +- tests/CMakeLists.txt | 8 ++++---- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f61011d540..c9c07bbcb6 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -164,6 +164,29 @@ name, pre-commit): pre-commit install ``` +### Build recipes + +This builds with the Intel compiler (assuming it is in your path, along with a +recent CMake and Python 3): + +```bash +python3 -m venv venv +. venv/bin/activate +pip install pytest +cmake -S . -B build-intel -DCMAKE_CXX_COMPILER=$(which icpc) -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON -DPYBIND11_WERROR=ON +``` + +This will test the PGI compilers: + +```bash +docker run --rm -it -v $PWD:/pybind11 nvcr.io/hpc/pgi-compilers:ce +apt-get update && apt-get install -y python3-dev python3-pip python3-pytest +wget -qO- "https://cmake.org/files/v3.18/cmake-3.18.1-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local +cmake -S pybind11/ -B build +cmake --build build +``` + + [pre-commit]: https://pre-commit.com [pybind11.readthedocs.org]: http://pybind11.readthedocs.org/en/latest [issue tracker]: https://github.com/pybind/pybind11/issues diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6be6cc015d..15f40ac5ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -293,7 +293,7 @@ jobs: - name: Interface test run: cmake --build build --target test_cmake_build - + gcc: runs-on: ubuntu-latest strategy: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e1d4c91543..a6434bf90e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -317,10 +317,10 @@ foreach(target ${test_targets}) endif() if(${CMAKE_CXX_COMPILER_ID} MATCHES "PGI") - target_compile_options(${target} PRIVATE -Wc,--pending_instantiations=0) - if(NOT WIN32) - target_compile_definitions(${target} PRIVATE -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1) - endif() + # target_compile_options(${target} PRIVATE -Wc,--pending_instantiations=0) + # if(NOT WIN32) + # target_compile_definitions(${target} PRIVATE -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1) + # endif() endif() if(EIGEN3_FOUND) From 5332d745fc69b4cd9b3b10ddefde6680d28e213f Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 14:08:41 -0400 Subject: [PATCH 17/27] Try just adding flags on CentOS 7 --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15f40ac5ac..e33ce9ce92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -280,7 +280,10 @@ jobs: run: | source /etc/profile.d/modules.sh module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 - cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=11 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") + cmake -S . -B build -DDOWNLOAD_CATCH=ON \ + -DCMAKE_CXX_STANDARD=11 \ + -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \ + -DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" - name: Build run: cmake --build build -j 2 From 4469de8b44c2396c5d2f9ed3083027e153ac1968 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 14:36:44 -0400 Subject: [PATCH 18/27] fix: CentOS 7 --- .github/workflows/ci.yml | 3 ++- tests/CMakeLists.txt | 15 ++++++++------- tests/test_smart_ptr.py | 5 +++-- tests/test_virtual_functions.py | 4 ++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e33ce9ce92..f44d02da5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -283,7 +283,8 @@ jobs: cmake -S . -B build -DDOWNLOAD_CATCH=ON \ -DCMAKE_CXX_STANDARD=11 \ -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \ - -DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" + -DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" \ + -DPYBIND11_TEST_FILTER="test_smart_ptr.cpp;test_virtual_functions.cpp" - name: Build run: cmake --build build -j 2 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a6434bf90e..450a8b8c5f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -57,6 +57,9 @@ option(PYBIND11_CUDA_TESTS "Enable building CUDA tests (requires CMake 3.12+)" O set(PYBIND11_TEST_OVERRIDE "" CACHE STRING "Tests from ;-separated list of *.cpp files will be built instead of all tests") +set(PYBIND11_TEST_FILTER + "" + CACHE STRING "Tests from ;-separated list of *.cpp files will be removed from all tests") if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) # We're being loaded directly, i.e. not via add_subdirectory, so make this @@ -129,6 +132,11 @@ if(PYBIND11_TEST_OVERRIDE) set(PYBIND11_TEST_FILES ${PYBIND11_TEST_OVERRIDE}) endif() +# You can also filter tests: +if(PYBIND11_TEST_FILTER) + pybind11_filter_tests(PYBIND11_TEST_FILES ${PYBIND11_TEST_FILTER}) +endif() + if(PYTHON_VERSION VERSION_LESS 3.5) pybind11_filter_tests(PYBIND11_TEST_FILES test_async.cpp MESSAGE "Skipping test_async on Python 2") @@ -316,13 +324,6 @@ foreach(target ${test_targets}) target_compile_options(${target} PRIVATE /utf-8) endif() - if(${CMAKE_CXX_COMPILER_ID} MATCHES "PGI") - # target_compile_options(${target} PRIVATE -Wc,--pending_instantiations=0) - # if(NOT WIN32) - # target_compile_definitions(${target} PRIVATE -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1) - # endif() - endif() - if(EIGEN3_FOUND) target_link_libraries(${target} PRIVATE Eigen3::Eigen) target_compile_definitions(${target} PRIVATE -DPYBIND11_TEST_EIGEN) diff --git a/tests/test_smart_ptr.py b/tests/test_smart_ptr.py index c9267f6878..0b1ca45b5a 100644 --- a/tests/test_smart_ptr.py +++ b/tests/test_smart_ptr.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- import pytest -from pybind11_tests import smart_ptr as m -from pybind11_tests import ConstructorStats + +m = pytest.importorskip("pybind11_tests.smart_ptr") +from pybind11_tests import ConstructorStats # noqa: E402 def test_smart_ptr(capture): diff --git a/tests/test_virtual_functions.py b/tests/test_virtual_functions.py index b7bd5badf0..66a353ae7f 100644 --- a/tests/test_virtual_functions.py +++ b/tests/test_virtual_functions.py @@ -3,8 +3,8 @@ import env # noqa: F401 -from pybind11_tests import virtual_functions as m -from pybind11_tests import ConstructorStats +m = pytest.importorskip("pybind11_tests.virtual_functions") +from pybind11_tests import ConstructorStats # noqa: E402 def test_override(capture, msg): From 73127c5af2eb05acbe004d8d9541de5bb200de32 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 16:00:23 -0400 Subject: [PATCH 19/27] refactor: move include to shared location --- include/pybind11/detail/common.h | 1 + include/pybind11/detail/internals.h | 2 -- include/pybind11/pybind11.h | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 03cdb7d4b4..7d6530cc80 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -154,6 +154,7 @@ #include #include #include +#include #include #include #include diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 1ab3f87429..cf40e9fe99 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -11,8 +11,6 @@ #include "../pytypes.h" -#include - PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) PYBIND11_NAMESPACE_BEGIN(detail) // Forward declarations diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index a2611f5ee6..602d5790a2 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -50,8 +50,6 @@ # include #endif -#include - PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) /// Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object From cba62652a1a1bc99cc71011ef1de4dd61fac6492 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Fri, 11 Sep 2020 23:11:00 +0200 Subject: [PATCH 20/27] Added verbose flag --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f44d02da5d..b466517fbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -287,7 +287,7 @@ jobs: -DPYBIND11_TEST_FILTER="test_smart_ptr.cpp;test_virtual_functions.cpp" - name: Build - run: cmake --build build -j 2 + run: cmake --build build -j 2 --verbose - name: Python tests run: cmake --build build --target pytest From 7280383bc77455589279b66ae9b5cd112bd1aca4 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Fri, 11 Sep 2020 23:26:31 +0200 Subject: [PATCH 21/27] Try to use system cmake3 on CI --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b466517fbb..1f67473897 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,7 +265,7 @@ jobs: - uses: actions/checkout@v2 - name: Add Python 3 and a few requirements - run: yum update -y && yum install -y git python3-devel make environment-modules + run: yum update -y && yum install -y git python3-devel make environment-modules cmake3 - name: Install CMake with pip run: | @@ -280,23 +280,23 @@ jobs: run: | source /etc/profile.d/modules.sh module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.7 - cmake -S . -B build -DDOWNLOAD_CATCH=ON \ + cmake3 -S . -B build -DDOWNLOAD_CATCH=ON \ -DCMAKE_CXX_STANDARD=11 \ -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \ -DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" \ -DPYBIND11_TEST_FILTER="test_smart_ptr.cpp;test_virtual_functions.cpp" - name: Build - run: cmake --build build -j 2 --verbose + run: cmake3 --build build -j 2 --verbose - name: Python tests - run: cmake --build build --target pytest + run: cmake3 --build build --target pytest - name: C++ tests - run: cmake --build build --target cpptest + run: cmake3 --build build --target cpptest - name: Interface test - run: cmake --build build --target test_cmake_build + run: cmake3 --build build --target test_cmake_build gcc: runs-on: ubuntu-latest From fd624221a4546e140fe618099d5dcdb82759a7c6 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Fri, 11 Sep 2020 23:39:12 +0200 Subject: [PATCH 22/27] Try to use system cmake3 on CI, attempt2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f67473897..b7aec155b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,7 +265,7 @@ jobs: - uses: actions/checkout@v2 - name: Add Python 3 and a few requirements - run: yum update -y && yum install -y git python3-devel make environment-modules cmake3 + run: yum update -y && yum install epel-release && yum install -y git python3-devel make environment-modules cmake3 - name: Install CMake with pip run: | From f1478d68afb633db6f49bc7ba330665cfab95cca Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Fri, 11 Sep 2020 23:46:41 +0200 Subject: [PATCH 23/27] Try to use system cmake3 on CI, attempt3 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7aec155b6..fe7feff9db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,7 +265,7 @@ jobs: - uses: actions/checkout@v2 - name: Add Python 3 and a few requirements - run: yum update -y && yum install epel-release && yum install -y git python3-devel make environment-modules cmake3 + run: yum update -y && yum install -y epel-release && yum install -y git python3-devel make environment-modules cmake3 - name: Install CMake with pip run: | From 0a99b161435e5889b21d3267b6148bef7e7bc5e3 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 17:26:25 -0400 Subject: [PATCH 24/27] tests: not finding pytest should be a warning, not a fatal error --- .github/workflows/ci.yml | 8 ++++++-- tests/CMakeLists.txt | 17 +++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe7feff9db..9a5758ed31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,7 +235,9 @@ jobs: python3 -m pip install cmake --prefer-binary - name: Install NVidia HPC SDK - run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm + run: > + yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm + https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm - name: Configure shell: bash @@ -273,7 +275,9 @@ jobs: python3 -m pip install pytest cmake --prefer-binary - name: Install NVidia HPC SDK - run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm + run: > + yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm + https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm - name: Configure shell: bash diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 450a8b8c5f..45e094b080 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -346,7 +346,7 @@ foreach(target ${test_targets}) endif() endforeach() -# Make sure pytest is found or produce a fatal error +# Make sure pytest is found or produce a warning if(NOT PYBIND11_PYTEST_FOUND) execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import pytest; print(pytest.__version__)" @@ -354,15 +354,16 @@ if(NOT PYBIND11_PYTEST_FOUND) OUTPUT_VARIABLE pytest_version ERROR_QUIET) if(pytest_not_found) - message(FATAL_ERROR "Running the tests requires pytest. Please install it manually" - " (try: ${PYTHON_EXECUTABLE} -m pip install pytest)") + message(WARNING "Running the tests requires pytest. Please install it manually" + " (try: ${PYTHON_EXECUTABLE} -m pip install pytest)") elseif(pytest_version VERSION_LESS 3.1) - message(FATAL_ERROR "Running the tests requires pytest >= 3.1. Found: ${pytest_version}" - "Please update it (try: ${PYTHON_EXECUTABLE} -m pip install -U pytest)") + message(WARNING "Running the tests requires pytest >= 3.1. Found: ${pytest_version}" + "Please update it (try: ${PYTHON_EXECUTABLE} -m pip install -U pytest)") + else() + set(PYBIND11_PYTEST_FOUND + TRUE + CACHE INTERNAL "") endif() - set(PYBIND11_PYTEST_FOUND - TRUE - CACHE INTERNAL "") endif() if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) From 287f74e68c23e56d8e7d32ffeebc513fcef4526c Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 17:58:48 -0400 Subject: [PATCH 25/27] tests: cleanup --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a5758ed31..9b58ac9ad0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -212,7 +212,7 @@ jobs: run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON - name: Build - run: cmake --build build -j2 -v + run: cmake --build build -j2 --verbose - name: Python tests run: cmake --build build --target pytest @@ -247,7 +247,7 @@ jobs: cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - name: Build - run: cmake --build build -j 2 + run: cmake --build build -j 2 --verbose - name: Python tests run: cmake --build build --target pytest @@ -267,12 +267,7 @@ jobs: - uses: actions/checkout@v2 - name: Add Python 3 and a few requirements - run: yum update -y && yum install -y epel-release && yum install -y git python3-devel make environment-modules cmake3 - - - name: Install CMake with pip - run: | - python3 -m pip install --upgrade pip - python3 -m pip install pytest cmake --prefer-binary + run: yum update -y && yum install -y epel-release && yum install -y git python3-devel make environment-modules cmake3 - name: Install NVidia HPC SDK run: > @@ -293,6 +288,11 @@ jobs: - name: Build run: cmake3 --build build -j 2 --verbose + - name: Install CMake with pip + run: | + python3 -m pip install --upgrade pip + python3 -m pip install pytest + - name: Python tests run: cmake3 --build build --target pytest From 663683f3c1fd15bece53b5c0d018cf8872db8173 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 18:27:37 -0400 Subject: [PATCH 26/27] Weird issue? --- .github/workflows/ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b58ac9ad0..6f0a6f5abd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,9 +235,7 @@ jobs: python3 -m pip install cmake --prefer-binary - name: Install NVidia HPC SDK - run: > - yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm - https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm + run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm - name: Configure shell: bash @@ -270,9 +268,7 @@ jobs: run: yum update -y && yum install -y epel-release && yum install -y git python3-devel make environment-modules cmake3 - name: Install NVidia HPC SDK - run: > - yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm - https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm + run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm - name: Configure shell: bash From 20c901c1bced897db1a8428100011c5325fdf07a Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 11 Sep 2020 21:31:40 -0400 Subject: [PATCH 27/27] fix: final polish --- .github/CONTRIBUTING.md | 2 +- .github/workflows/ci.yml | 15 ++++++++++----- docs/changelog.rst | 10 ++++++++++ tests/test_factory_constructors.cpp | 7 +++---- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c9c07bbcb6..e83c31565d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -181,7 +181,7 @@ This will test the PGI compilers: ```bash docker run --rm -it -v $PWD:/pybind11 nvcr.io/hpc/pgi-compilers:ce apt-get update && apt-get install -y python3-dev python3-pip python3-pytest -wget -qO- "https://cmake.org/files/v3.18/cmake-3.18.1-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local +wget -qO- "https://cmake.org/files/v3.18/cmake-3.18.2-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local cmake -S pybind11/ -B build cmake --build build ``` diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f0a6f5abd..530d8caf38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -218,10 +218,10 @@ jobs: run: cmake --build build --target pytest - centos-nvhpc: + centos-nvhpc8: runs-on: ubuntu-latest - name: "🐍 3 • CentOS8/PGI • x64" - container: "centos:8" + name: "🐍 3 • CentOS8 / PGI 20.7 • x64" + container: centos:8 steps: - uses: actions/checkout@v2 @@ -258,8 +258,8 @@ jobs: centos-nvhpc7: runs-on: ubuntu-latest - name: "🐍 3 • CentOS7/PGI • x64" - container: "centos:7" + name: "🐍 3 • CentOS7 / PGI 20.7 • x64" + container: centos:7 steps: - uses: actions/checkout@v2 @@ -270,6 +270,10 @@ jobs: - name: Install NVidia HPC SDK run: yum -y install https://developer.download.nvidia.com/hpc-sdk/nvhpc-20-7-20.7-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/nvhpc-2020-20.7-1.x86_64.rpm + # On CentOS 7, we have to filter a few tests (compiler internal error) + # and allow deeper templete recursion (not needed on CentOS 8 with a newer + # standard library). On some systems, you many need further workarounds: + # https://github.com/pybind/pybind11/pull/2475 - name: Configure shell: bash run: | @@ -281,6 +285,7 @@ jobs: -DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" \ -DPYBIND11_TEST_FILTER="test_smart_ptr.cpp;test_virtual_functions.cpp" + # Building before installing Pip should produce a warning but not an error - name: Build run: cmake3 --build build -j 2 --verbose diff --git a/docs/changelog.rst b/docs/changelog.rst index ca025f9d83..77fd441735 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -80,6 +80,9 @@ Smaller or developer focused features: * Bugfixes related to more extensive testing `#2321 `_ +* Bug in timezone issue in Eastern hemisphere midnight fixed. + `#2438 `_ + * Pointer to ``std::tuple`` & ``std::pair`` supported in cast. `#2334 `_ @@ -96,6 +99,13 @@ Smaller or developer focused features: * Debug Python interpreter support. `#2025 `_ +* NVCC (CUDA 11) now supported and tested in CI. + `#2461 `_ + +* NVIDIA PGI compilers now supported and tested in CI. + `#2475 `_ + + v2.5.0 (Mar 31, 2020) diff --git a/tests/test_factory_constructors.cpp b/tests/test_factory_constructors.cpp index 812f4dc3d2..f614743460 100644 --- a/tests/test_factory_constructors.cpp +++ b/tests/test_factory_constructors.cpp @@ -299,12 +299,11 @@ TEST_SUBMODULE(factory_constructors, m) { static void *operator new(size_t, void *p) { py::print("noisy placement new"); return p; } static void operator delete(void *p, size_t) { py::print("noisy delete"); ::operator delete(p); } static void operator delete(void *, void *) { py::print("noisy placement delete"); } -# if defined(_MSC_VER) && _MSC_VER < 1910 +#if defined(_MSC_VER) && _MSC_VER < 1910 // MSVC 2015 bug: the above "noisy delete" isn't invoked (fixed in MSVC 2017) - static void operator delete(void *p) { py::print("noisy delete"); ::operator delete(p); } -# endif + static void operator delete(void *p) { py::print("noisy delete"); ::operator delete(p); } +#endif }; - py::class_(m, "NoisyAlloc") // Since these overloads have the same number of arguments, the dispatcher will try each of // them until the arguments convert. Thus we can get a pre-allocation here when passing a