From 8437f1485eefdb8163fb449f99abbf7178b83c2f Mon Sep 17 00:00:00 2001 From: Wiebe van Breukelen Date: Tue, 5 Nov 2024 09:00:31 +0100 Subject: [PATCH] Renamed functions and removed getTotalConstMem() --- CHANGELOG.md | 2 +- include/cudawrappers/cu.hpp | 7 +------ include/cudawrappers/cufft.hpp | 30 +++++++++++++++--------------- tests/test_cu.cpp | 11 ++--------- tests/test_cufft.cpp | 4 ++-- 5 files changed, 21 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f2d1cd..d379acf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ project adheres to [Semantic Versioning](http://semver.org/). - Added `cu::Stream::memcpyHtoD2DAsync()`, `cu::Stream::memcpyDtoHD2Async()`, and `cu::Stream::memcpyDtoD2DAsync()` - Added `cu::DeviceMemory::memset2D()` and `cu::Stream::memset2DAsync()` -- Added `cufft::FFT1D_R2C` and `cufft::FFT1D_C2R` +- Added `cufft::FFT1DR2C` and `cufft::FFT1DC2R` - Added `cu::Device::getOrdinal()` ### Changed diff --git a/include/cudawrappers/cu.hpp b/include/cudawrappers/cu.hpp index 202ebbd..bacec83 100644 --- a/include/cudawrappers/cu.hpp +++ b/include/cudawrappers/cu.hpp @@ -182,17 +182,12 @@ class Device : public Wrapper { #endif } - size_t getTotalMem() const { + size_t totalMem() const { size_t size{}; checkCudaCall(cuDeviceTotalMem(&size, _obj)); return size; } - size_t getTotalConstMem() const { - return static_cast( - getAttribute(CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY)); - } - int getOrdinal() const { return _ordinal; } // Primary Context Management diff --git a/include/cudawrappers/cufft.hpp b/include/cudawrappers/cufft.hpp index fb96132..57a08df 100644 --- a/include/cudawrappers/cufft.hpp +++ b/include/cudawrappers/cufft.hpp @@ -231,30 +231,30 @@ FFT2D::FFT2D(const int nx, const int ny) : FFT2D(nx, ny, 1, nx * ny, 1) {} /* - * FFT1D_R2C + * FFT1DR2C */ template -class FFT1D_R2C : public FFT { +class FFT1DR2C : public FFT { public: #if defined(__HIP__) __host__ #endif - FFT1D_R2C(const int nx) = delete; + FFT1DR2C(const int nx) = delete; #if defined(__HIP__) __host__ #endif - FFT1D_R2C(const int nx, const int batch) = delete; + FFT1DR2C(const int nx, const int batch) = delete; #if defined(__HIP__) __host__ #endif - FFT1D_R2C(const int nx, const int batch, long long inembed, - long long ouembed) = delete; + FFT1DR2C(const int nx, const int batch, long long inembed, + long long ouembed) = delete; }; template <> -FFT1D_R2C::FFT1D_R2C(const int nx, const int batch, - long long inembed, long long ouembed) { +FFT1DR2C::FFT1DR2C(const int nx, const int batch, long long inembed, + long long ouembed) { checkCuFFTCall(cufftCreate(plan())); const int rank = 1; size_t ws = 0; @@ -273,26 +273,26 @@ FFT1D_R2C::FFT1D_R2C(const int nx, const int batch, * FFT1D_C2R */ template -class FFT1D_C2R : public FFT { +class FFT1DC2R : public FFT { public: #if defined(__HIP__) __host__ #endif - FFT1D_C2R(const int nx) = delete; + FFT1DC2R(const int nx) = delete; #if defined(__HIP__) __host__ #endif - FFT1D_C2R(const int nx, const int batch) = delete; + FFT1DC2R(const int nx, const int batch) = delete; #if defined(__HIP__) __host__ #endif - FFT1D_C2R(const int nx, const int batch, long long inembed, - long long ouembed) = delete; + FFT1DC2R(const int nx, const int batch, long long inembed, + long long ouembed) = delete; }; template <> -FFT1D_C2R::FFT1D_C2R(const int nx, const int batch, - long long inembed, long long ouembed) { +FFT1DC2R::FFT1DC2R(const int nx, const int batch, long long inembed, + long long ouembed) { checkCuFFTCall(cufftCreate(plan())); const int rank = 1; size_t ws = 0; diff --git a/tests/test_cu.cpp b/tests/test_cu.cpp index cf5bc0a..2986498 100644 --- a/tests/test_cu.cpp +++ b/tests/test_cu.cpp @@ -24,20 +24,13 @@ TEST_CASE("Test cu::Device", "[device]") { CHECK(arch.size() > 0); } - SECTION("Test device.getTotalMem", "[device]") { - const size_t total_mem = device.getTotalMem(); + SECTION("Test device.totalMem", "[device]") { + const size_t total_mem = device.totalMem(); std::cout << "Device total memory: " << (total_mem / (1024 * 1024)) << " bytes" << std::endl; CHECK(total_mem > 0); } - SECTION("Test Device.getTotalConstMem", "[device]") { - const size_t const_mem = device.getTotalConstMem(); - std::cout << "Device constant memory: " << const_mem << " bytes" - << std::endl; - CHECK(const_mem > 0); - } - SECTION("Test Device.getOrdinal", "[device]") { const int dev_ordinal = device.getOrdinal(); CHECK(dev_ordinal >= 0); diff --git a/tests/test_cufft.cpp b/tests/test_cufft.cpp index 96194aa..afc5354 100644 --- a/tests/test_cufft.cpp +++ b/tests/test_cufft.cpp @@ -127,8 +127,8 @@ TEST_CASE("Test 1D FFT", "[FFT1D]") { generateSignal(static_cast(h_in), size, patchSize, {1, 1}); stream.memcpyHtoDAsync(d_in, h_in, arraySize); - cufft::FFT1D_R2C fft_r2c(size, 1, 1, 1); - cufft::FFT1D_C2R fft_c2r(size, 1, 1, 1); + cufft::FFT1DR2C fft_r2c(size, 1, 1, 1); + cufft::FFT1DC2R fft_c2r(size, 1, 1, 1); fft_r2c.setStream(stream); fft_c2r.setStream(stream);