From 4493b50c2f1abee56454afa0ae93e5ffffd22d79 Mon Sep 17 00:00:00 2001 From: eric bylaska Date: Mon, 29 Apr 2024 13:59:43 -0700 Subject: [PATCH] ...EJB --- Nwpw/nwpwlib/device/gdevices_cuda.hpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Nwpw/nwpwlib/device/gdevices_cuda.hpp b/Nwpw/nwpwlib/device/gdevices_cuda.hpp index abc53874..ccaecd66 100644 --- a/Nwpw/nwpwlib/device/gdevices_cuda.hpp +++ b/Nwpw/nwpwlib/device/gdevices_cuda.hpp @@ -5,6 +5,7 @@ #include "blas.h" #define NDEV_MAX 100 +#define NDEV_MAX_LARGE 10 #define DEBUG_IO false //#include "gdevice.hpp" @@ -209,9 +210,9 @@ class Gdevices { double *dev_mem[NDEV_MAX]; int ndev_mem_large = 0; - bool inuse_large[NDEV_MAX] = {false}; - size_t ndsize_mem_large[NDEV_MAX]; - double *dev_mem_large[NDEV_MAX]; + bool inuse_large[NDEV_MAX_LARGE] = {false}; + size_t ndsize_mem_large[NDEV_MAX_LARGE]; + double *dev_mem_large[NDEV_MAX_LARGE]; int tile_fac = 1; @@ -260,6 +261,7 @@ class Gdevices { * * **************************************/ ~Gdevices() noexcept(false) { + // free dev_mem for (auto i=0; iNDEV_MAX) std::cout << "ERROR: ndev_mem > NDEV_MAX" << std::endl; + if (ndev_mem>NDEV_MAX_LARGE) std::cout << "ERROR: ndev_mem > NDEV_MAX_LARGE" << std::endl; } NWPW_CUDA_ERROR(cudaMemset(dev_mem_large[ii], 0, ndsize * sizeof(double)));