From 23e7c29e5c10540dd06bcc477b95746c2d77d582 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 10 Oct 2023 08:41:45 -0400 Subject: [PATCH 1/8] Test with gcc13 and python 3.12. --- .github/workflows/release.yml | 2 +- .github/workflows/templates/configurations.yml | 11 ++++++----- .github/workflows/templates/workflow.yml | 2 +- .github/workflows/test.yml | 14 +++++++------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e60e81fb9c..6e45bb932b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: name: Build release tarball runs-on: ubuntu-latest container: - image: glotzerlab/ci:2023.07.24-ubuntu20.04 + image: glotzerlab/ci:2023.10.09-ubuntu20.04 steps: - name: Checkout diff --git a/.github/workflows/templates/configurations.yml b/.github/workflows/templates/configurations.yml index 0eea4085f8..5c6a18d09f 100644 --- a/.github/workflows/templates/configurations.yml +++ b/.github/workflows/templates/configurations.yml @@ -4,10 +4,10 @@ # - The build options are `mpi`, `tbb`, `llvm`, `nomd`, and `nohpmc`. unit_test_configurations: - config: "[clang14_py311, mpi, tbb, llvm]" -- config: "[gcc12_py311]" -- config: "[gcc12_py311, nomd]" -- config: "[gcc12_py311, nohpmc]" -- config: "[gcc12_py311, nomd, nohpmc]" +- config: "[gcc13_py312]" +- config: "[gcc13_py312, nomd]" +- config: "[gcc13_py312, nohpmc]" +- config: "[gcc13_py312, nomd, nohpmc]" - config: "[cuda120_gcc11_py310, mpi, llvm, debug]" - config: "[cuda120_gcc11_py310, mpi, llvm]" - config: "[cuda120_gcc11_py310]" @@ -17,13 +17,14 @@ unit_test_configurations: # `unit_test_configurations` validate_configurations: - config: "[clang14_py311, mpi, tbb, llvm]" -- config: "[gcc12_py311]" +- config: "[gcc13_py312]" - config: "[cuda120_gcc11_py310, mpi, llvm]" - config: "[cuda120_gcc11_py310]" # Configurations to build and test only rarely, such as just before a release. # There should be no overlap between this list and `unit_test_configurations` release_test_configurations: +- config: "[gcc12_py311]" - config: "[clang16_py311, mpi, llvm]" - config: "[clang15_py311, mpi, llvm]" - config: "[clang13_py310, llvm]" diff --git a/.github/workflows/templates/workflow.yml b/.github/workflows/templates/workflow.yml index ab97f0e637..7b5f59e4d5 100644 --- a/.github/workflows/templates/workflow.yml +++ b/.github/workflows/templates/workflow.yml @@ -1,5 +1,5 @@ <% block name %><% endblock %> -<% set container_prefix="glotzerlab/ci:2023.07.24" %> +<% set container_prefix="glotzerlab/ci:2023.10.09" %> <% block concurrency %> concurrency: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e1a99fd5d0..c24e80be9a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,7 +59,7 @@ jobs: name: Build [${{ join(matrix.config, '_') }}] runs-on: ${{ matrix.build_runner }} container: - image: glotzerlab/ci:2023.07.24-${{ matrix.config[0] }} + image: glotzerlab/ci:2023.10.09-${{ matrix.config[0] }} strategy: matrix: include: @@ -168,7 +168,7 @@ jobs: needs: build runs-on: ${{ matrix.test_runner }} container: - image: glotzerlab/ci:2023.07.24-${{ matrix.config[0] }} + image: glotzerlab/ci:2023.10.09-${{ matrix.config[0] }} options: ${{ matrix.test_docker_options }} -e CUDA_VISIBLE_DEVICES strategy: matrix: @@ -229,7 +229,7 @@ jobs: needs: build runs-on: ${{ matrix.test_runner }} container: - image: glotzerlab/ci:2023.07.24-${{ matrix.config[0] }} + image: glotzerlab/ci:2023.10.09-${{ matrix.config[0] }} options: ${{ matrix.test_docker_options }} -e CUDA_VISIBLE_DEVICES strategy: matrix: @@ -283,7 +283,7 @@ jobs: needs: build runs-on: ${{ matrix.test_runner }} container: - image: glotzerlab/ci:2023.07.24-${{ matrix.config[0] }} + image: glotzerlab/ci:2023.10.09-${{ matrix.config[0] }} options: ${{ matrix.test_docker_options }} -e CUDA_VISIBLE_DEVICES strategy: matrix: @@ -334,7 +334,7 @@ jobs: name: Build [${{ join(matrix.config, '_') }}] runs-on: ${{ matrix.build_runner }} container: - image: glotzerlab/ci:2023.07.24-${{ matrix.config[0] }} + image: glotzerlab/ci:2023.10.09-${{ matrix.config[0] }} strategy: matrix: include: @@ -447,7 +447,7 @@ jobs: needs: build_release runs-on: ${{ matrix.test_runner }} container: - image: glotzerlab/ci:2023.07.24-${{ matrix.config[0] }} + image: glotzerlab/ci:2023.10.09-${{ matrix.config[0] }} options: ${{ matrix.test_docker_options }} -e CUDA_VISIBLE_DEVICES strategy: matrix: @@ -516,7 +516,7 @@ jobs: needs: build_release runs-on: ${{ matrix.test_runner }} container: - image: glotzerlab/ci:2023.07.24-${{ matrix.config[0] }} + image: glotzerlab/ci:2023.10.09-${{ matrix.config[0] }} options: ${{ matrix.test_docker_options }} -e CUDA_VISIBLE_DEVICES strategy: matrix: From 6038000afc3fe368f83c5f6ac3cc98188d71ab78 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 10 Oct 2023 08:50:34 -0400 Subject: [PATCH 2/8] Document testing on gcc13. --- BUILDING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.rst b/BUILDING.rst index fdcfedfcb4..5ab69aeaa4 100644 --- a/BUILDING.rst +++ b/BUILDING.rst @@ -77,7 +77,7 @@ Install prerequisites **General requirements:** -- C++17 capable compiler (tested with ``gcc`` 9 - 12 and ``clang`` 10 - 16) +- C++17 capable compiler (tested with ``gcc`` 9 - 13 and ``clang`` 10 - 16) - Python >= 3.8 - NumPy >= 1.17.3 - pybind11 >= 2.2 From 558f05328282123e693e485911083960f40fc04f Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 10 Oct 2023 08:56:23 -0400 Subject: [PATCH 3/8] Run pre-commit. --- .github/workflows/test.yml | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c24e80be9a..3863a6358b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -64,10 +64,10 @@ jobs: matrix: include: - {config: [clang14_py311, mpi, tbb, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311, nomd], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311, nomd, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312, nomd], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312, nomd, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [cuda120_gcc11_py310, mpi, llvm, debug], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } - {config: [cuda120_gcc11_py310, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } - {config: [cuda120_gcc11_py310], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } @@ -174,10 +174,10 @@ jobs: matrix: include: - {config: [clang14_py311, mpi, tbb, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311, nomd], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311, nomd, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312, nomd], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312, nomd, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [cuda120_gcc11_py310, mpi, llvm, debug], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } - {config: [cuda120_gcc11_py310, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } - {config: [cuda120_gcc11_py310], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } @@ -235,10 +235,10 @@ jobs: matrix: include: - {config: [clang14_py311, mpi, tbb, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311, nomd], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311, nomd, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312, nomd], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312, nomd, nohpmc], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [cuda120_gcc11_py310, mpi, llvm, debug], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } - {config: [cuda120_gcc11_py310, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } - {config: [cuda120_gcc11_py310], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } @@ -289,7 +289,7 @@ jobs: matrix: include: - {config: [clang14_py311, mpi, tbb, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - - {config: [gcc12_py311], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } + - {config: [gcc13_py312], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [cuda120_gcc11_py310, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } - {config: [cuda120_gcc11_py310], build_runner: [self-hosted,jetstream2,CPU], test_runner: [self-hosted,GPU], test_docker_options: '--gpus=all --device /dev/nvidia0 --device /dev/nvidia1 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl' } @@ -338,6 +338,7 @@ jobs: strategy: matrix: include: + - {config: [gcc12_py311], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [clang16_py311, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [clang15_py311, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [clang13_py310, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } @@ -452,6 +453,7 @@ jobs: strategy: matrix: include: + - {config: [gcc12_py311], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [clang16_py311, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [clang15_py311, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [clang13_py310, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } @@ -521,6 +523,7 @@ jobs: strategy: matrix: include: + - {config: [gcc12_py311], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [clang16_py311, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [clang15_py311, mpi, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } - {config: [clang13_py310, llvm], build_runner: [self-hosted,jetstream2,CPU], test_runner: ubuntu-latest, test_docker_options: '' } From 5b870c60289958c91f7ac7a98f4ac610d8f6ef7e Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 10 Oct 2023 09:11:06 -0400 Subject: [PATCH 4/8] Rename initialization method to avoid compiler warning. --- hoomd/MeshGroupData.cc | 6 +++--- hoomd/MeshGroupData.h | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hoomd/MeshGroupData.cc b/hoomd/MeshGroupData.cc index 8e083c50a3..c8c2bd0ed8 100644 --- a/hoomd/MeshGroupData.cc +++ b/hoomd/MeshGroupData.cc @@ -76,7 +76,7 @@ MeshGroupData::MeshGroupData(std::shared_ptr::setDirty>(this); // initialize from snapshot - initializeFromSnapshot(snapshot); + initializeFromTriangleSnapshot(snapshot); #ifdef ENABLE_MPI if (this->m_pdata->getDomainDecomposition()) @@ -106,7 +106,7 @@ MeshGroupData::~MeshGroupData() //! Initialize from a snapshot template -void MeshGroupData::initializeFromSnapshot( +void MeshGroupData::initializeFromTriangleSnapshot( const TriangleData::Snapshot& snapshot) { // check that all fields in the snapshot have correct length @@ -590,7 +590,7 @@ void export_MeshGroupData(pybind11::module& m, .def(pybind11::init, unsigned int>()) .def( pybind11::init, const typename TriangleData::Snapshot&>()) - .def("initializeFromSnapshot", &T::initializeFromSnapshot) + .def("initializeFromTriangleSnapshot", &T::initializeFromTriangleSnapshot) .def("takeSnapshot", &T::takeSnapshot) .def("getN", &T::getN) .def("getNGlobal", &T::getNGlobal) diff --git a/hoomd/MeshGroupData.h b/hoomd/MeshGroupData.h index 8207c15dd8..72cf15ad4e 100644 --- a/hoomd/MeshGroupData.h +++ b/hoomd/MeshGroupData.h @@ -61,11 +61,13 @@ class MeshGroupData : public BondedGroupData virtual ~MeshGroupData(); -// mask the base class initializeFromSnapshot(const Snapshot& snapshot) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Woverloaded-virtual" - void initializeFromSnapshot(const TriangleData::Snapshot& snapshot); -#pragma clang diagnostic pop + virtual void initializeFromSnapshot( + const typename BondedGroupData::Snapshot& snapshot) + { + throw std::runtime_error("Not implemented"); + } + + void initializeFromTriangleSnapshot(const TriangleData::Snapshot& snapshot); //! Take a snapshot std::map takeSnapshot(snap& snapshot) const; From f87910422147efaf585962db605e80cd38671508 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 10 Oct 2023 09:19:57 -0400 Subject: [PATCH 5/8] Bump to latest quickhull commit. Supports gcc13. --- hoomd/extern/quickhull | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoomd/extern/quickhull b/hoomd/extern/quickhull index a706b5ba0d..1ffbc6f884 160000 --- a/hoomd/extern/quickhull +++ b/hoomd/extern/quickhull @@ -1 +1 @@ -Subproject commit a706b5ba0d863b241668038be9eef67afbfaabac +Subproject commit 1ffbc6f884ea1da89e104a5996cf8a726db673d5 From 9a993a9ca8cf2e7c54e305bd6220386471547ee9 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 10 Oct 2023 10:03:27 -0400 Subject: [PATCH 6/8] Fix gcc13 warnings. --- hoomd/hpmc/ShapeConvexPolyhedron.h | 3 --- hoomd/managed_allocator.h | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/hoomd/hpmc/ShapeConvexPolyhedron.h b/hoomd/hpmc/ShapeConvexPolyhedron.h index ab53c33898..6faca6d941 100644 --- a/hoomd/hpmc/ShapeConvexPolyhedron.h +++ b/hoomd/hpmc/ShapeConvexPolyhedron.h @@ -55,9 +55,6 @@ struct PolyhedronVertices : ShapeParams PolyhedronVertices(unsigned int _N, bool managed = false) : ignore(0) { std::vector> v(_N, vec3(0, 0, 0)); - x = ManagedArray(1, managed); - y = ManagedArray(1, managed); - z = ManagedArray(1, managed); setVerts(v, 0); } diff --git a/hoomd/managed_allocator.h b/hoomd/managed_allocator.h index a1951a4a30..4bb7035c4f 100644 --- a/hoomd/managed_allocator.h +++ b/hoomd/managed_allocator.h @@ -143,6 +143,7 @@ template class managed_allocator if (!result) throw std::bad_alloc(); } + memset(result, 0, n * sizeof(T)); allocation_bytes = n * sizeof(T); allocation_ptr = result; } From d3102266d81c8eca021049b9a14c706a619c19af Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 10 Oct 2023 10:49:38 -0400 Subject: [PATCH 7/8] Fix setVerts managed allocation. --- hoomd/hpmc/ShapeConvexPolyhedron.h | 9 ++++----- hoomd/managed_allocator.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hoomd/hpmc/ShapeConvexPolyhedron.h b/hoomd/hpmc/ShapeConvexPolyhedron.h index 6faca6d941..48e6fc7a30 100644 --- a/hoomd/hpmc/ShapeConvexPolyhedron.h +++ b/hoomd/hpmc/ShapeConvexPolyhedron.h @@ -55,7 +55,7 @@ struct PolyhedronVertices : ShapeParams PolyhedronVertices(unsigned int _N, bool managed = false) : ignore(0) { std::vector> v(_N, vec3(0, 0, 0)); - setVerts(v, 0); + setVerts(v, 0, managed); } PolyhedronVertices(const std::vector>& verts, @@ -66,7 +66,7 @@ struct PolyhedronVertices : ShapeParams z((unsigned int)verts.size(), managed), n_hull_verts(0), N((unsigned int)verts.size()), diameter(0.0), sweep_radius(sweep_radius_), ignore(ignore_) { - setVerts(verts, sweep_radius_); + setVerts(verts, sweep_radius_, managed); } /** Set the shape vertices @@ -76,12 +76,11 @@ struct PolyhedronVertices : ShapeParams @param verts Vertices to set @param sweep_radius_ Sweep radius */ - void setVerts(const std::vector>& verts, ShortReal sweep_radius_) + void setVerts(const std::vector>& verts, ShortReal sweep_radius_, bool managed=false) { N = (unsigned int)verts.size(); diameter = 0; sweep_radius = sweep_radius_; - bool managed = x.isManaged(); unsigned int align_size = 8; // for AVX unsigned int N_align = ((N + align_size - 1) / align_size) * align_size; @@ -163,7 +162,7 @@ struct PolyhedronVertices : ShapeParams vert_vector.push_back(vert); } - setVerts(vert_vector, v["sweep_radius"].cast()); + setVerts(vert_vector, v["sweep_radius"].cast(), managed); } /// Convert parameters to a python dictionary diff --git a/hoomd/managed_allocator.h b/hoomd/managed_allocator.h index 4bb7035c4f..8a691ae55d 100644 --- a/hoomd/managed_allocator.h +++ b/hoomd/managed_allocator.h @@ -143,6 +143,7 @@ template class managed_allocator if (!result) throw std::bad_alloc(); } + memset(result, 0, n * sizeof(T)); allocation_bytes = n * sizeof(T); allocation_ptr = result; From 488043faa0b498bd4fe7fee550514b393c18c34a Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 10 Oct 2023 10:52:14 -0400 Subject: [PATCH 8/8] Run pre-commit. --- hoomd/hpmc/ShapeConvexPolyhedron.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hoomd/hpmc/ShapeConvexPolyhedron.h b/hoomd/hpmc/ShapeConvexPolyhedron.h index 48e6fc7a30..bee2cef2ef 100644 --- a/hoomd/hpmc/ShapeConvexPolyhedron.h +++ b/hoomd/hpmc/ShapeConvexPolyhedron.h @@ -76,7 +76,9 @@ struct PolyhedronVertices : ShapeParams @param verts Vertices to set @param sweep_radius_ Sweep radius */ - void setVerts(const std::vector>& verts, ShortReal sweep_radius_, bool managed=false) + void setVerts(const std::vector>& verts, + ShortReal sweep_radius_, + bool managed = false) { N = (unsigned int)verts.size(); diameter = 0;