Skip to content

Commit

Permalink
Renamed functions and removed getTotalConstMem()
Browse files Browse the repository at this point in the history
  • Loading branch information
wvbbreu committed Nov 5, 2024
1 parent 27a8cb2 commit 8437f14
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions include/cudawrappers/cu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,12 @@ class Device : public Wrapper<CUdevice> {
#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<size_t>(
getAttribute(CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY));
}

int getOrdinal() const { return _ordinal; }

// Primary Context Management
Expand Down
30 changes: 15 additions & 15 deletions include/cudawrappers/cufft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,30 +231,30 @@ FFT2D<CUDA_C_16F>::FFT2D(const int nx, const int ny)
: FFT2D(nx, ny, 1, nx * ny, 1) {}

/*
* FFT1D_R2C
* FFT1DR2C
*/
template <cudaDataType_t T>
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<CUDA_R_32F>::FFT1D_R2C(const int nx, const int batch,
long long inembed, long long ouembed) {
FFT1DR2C<CUDA_R_32F>::FFT1DR2C(const int nx, const int batch, long long inembed,
long long ouembed) {
checkCuFFTCall(cufftCreate(plan()));
const int rank = 1;
size_t ws = 0;
Expand All @@ -273,26 +273,26 @@ FFT1D_R2C<CUDA_R_32F>::FFT1D_R2C(const int nx, const int batch,
* FFT1D_C2R
*/
template <cudaDataType_t T>
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<CUDA_C_32F>::FFT1D_C2R(const int nx, const int batch,
long long inembed, long long ouembed) {
FFT1DC2R<CUDA_C_32F>::FFT1DC2R(const int nx, const int batch, long long inembed,
long long ouembed) {
checkCuFFTCall(cufftCreate(plan()));
const int rank = 1;
size_t ws = 0;
Expand Down
11 changes: 2 additions & 9 deletions tests/test_cu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cufft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ TEST_CASE("Test 1D FFT", "[FFT1D]") {
generateSignal(static_cast<cufftComplex *>(h_in), size, patchSize, {1, 1});
stream.memcpyHtoDAsync(d_in, h_in, arraySize);

cufft::FFT1D_R2C<CUDA_R_32F> fft_r2c(size, 1, 1, 1);
cufft::FFT1D_C2R<CUDA_C_32F> fft_c2r(size, 1, 1, 1);
cufft::FFT1DR2C<CUDA_R_32F> fft_r2c(size, 1, 1, 1);
cufft::FFT1DC2R<CUDA_C_32F> fft_c2r(size, 1, 1, 1);
fft_r2c.setStream(stream);
fft_c2r.setStream(stream);

Expand Down

0 comments on commit 8437f14

Please sign in to comment.