gpuNUFFT 0.6.3__tar.gz → 0.7.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/gpuNUFFT_kernels.hpp +2 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/atomic/CMakeLists.txt +3 -2
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/python/CMakeLists.txt +10 -7
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/python/gpuNUFFT_operator_python_factory.cpp +173 -16
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/std_gpuNUFFT_kernels.cu +19 -0
- gpuNUFFT-0.7.1/MANIFEST.in +5 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/PKG-INFO +1 -1
- {gpuNUFFT-0.6.3/CUDA/bin → gpuNUFFT-0.7.1}/gpuNUFFT.egg-info/PKG-INFO +1 -1
- gpuNUFFT-0.7.1/gpuNUFFT.egg-info/SOURCES.txt +56 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/setup.py +12 -3
- gpuNUFFT-0.6.3/CUDA/bin/cvp/Gridding3D.cvp +0 -34
- gpuNUFFT-0.6.3/CUDA/bin/cvp/README +0 -4
- gpuNUFFT-0.6.3/CUDA/bin/gpuNUFFT.egg-info/SOURCES.txt +0 -9
- gpuNUFFT-0.6.3/CUDA/bin/gtest_options +0 -3
- gpuNUFFT-0.6.3/CUDA/bin/run_cpu_filtered_unit_test.cmd +0 -1
- gpuNUFFT-0.6.3/CUDA/bin/run_cuda_memcheck +0 -4
- gpuNUFFT-0.6.3/CUDA/bin/run_gpu_filtered_unit_test.cmd +0 -1
- gpuNUFFT-0.6.3/CUDA/build/configure_double_prec +0 -1
- gpuNUFFT-0.6.3/CUDA/build/configure_single_prec +0 -1
- gpuNUFFT-0.6.3/CUDA/cmake_modules/FindGPUNUFFT.cmake +0 -24
- gpuNUFFT-0.6.3/CUDA/test/CMakeLists.txt +0 -30
- gpuNUFFT-0.6.3/CUDA/test/cpu/CMakeLists.txt +0 -16
- gpuNUFFT-0.6.3/CUDA/test/cpu/gpuNUFFT_kernel_tests.cpp +0 -27
- gpuNUFFT-0.6.3/CUDA/test/cpu/gpuNUFFT_operator_factory_tests.cpp +0 -167
- gpuNUFFT-0.6.3/CUDA/test/cpu/gpuNUFFT_precomputation_tests.cpp +0 -1054
- gpuNUFFT-0.6.3/CUDA/test/cpu/gpuNUFFT_tests.cpp +0 -1168
- gpuNUFFT-0.6.3/CUDA/test/gpu/forward/gpuNUFFT_forward_tests.cpp +0 -390
- gpuNUFFT-0.6.3/CUDA/test/gpu/gpuNUFFT_2D_conv_tests.cpp +0 -1204
- gpuNUFFT-0.6.3/CUDA/test/gpu/gpuNUFFT_conv_tests.cpp +0 -1670
- gpuNUFFT-0.6.3/CUDA/test/gpu/gpuNUFFT_deapo_tests.cpp +0 -438
- gpuNUFFT-0.6.3/CUDA/test/gpu/gpuNUFFT_fft_tests.cpp +0 -818
- gpuNUFFT-0.6.3/pyproject.toml +0 -2
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/CMakeLists.txt +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/doc/CMakeLists.txt +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/doc/Doxyfile +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/doc/mainpage.dox +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/balanced_gpuNUFFT_operator.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/balanced_operator.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/balanced_texture_gpuNUFFT_operator.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/config.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/config.hpp.cmake +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/cuda_utils.cuh +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/cuda_utils.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/cufft_config.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/cufft_config.hpp.cmake +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/gpuNUFFT_cpu.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/gpuNUFFT_operator.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/gpuNUFFT_operator_factory.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/gpuNUFFT_types.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/gpuNUFFT_utils.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/matlab_helper.h +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/precomp_kernels.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/precomp_utils.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/inc/texture_gpuNUFFT_operator.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/CMakeLists.txt +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/balanced_gpuNUFFT_operator.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/balanced_texture_gpuNUFFT_operator.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/cpu/gpuNUFFT_cpu.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/CMakeLists.txt +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/atomic/atomic_gpuNUFFT.cu +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/atomic/atomic_gpuNUFFT_kernels.cu +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/atomic/texture_gpuNUFFT_kernels.cu +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/matlab/CMakeLists.txt +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/matlab/gpuNUFFT_adj.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/matlab/gpuNUFFT_forw.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/matlab/gpuNUFFT_operator_matlabfactory.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/matlab/gpuNUFFT_operator_matlabfactory.hpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/matlab/precomputation/CMakeLists.txt +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/matlab/precomputation/gpuNUFFT_precomp.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpu/precomp_kernels.cu +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpuNUFFT_operator.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpuNUFFT_operator_factory.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/gpuNUFFT_utils.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/CUDA/src/texture_gpuNUFFT_operator.cpp +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/LICENSE +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/README.md +0 -0
- {gpuNUFFT-0.6.3/CUDA/bin → gpuNUFFT-0.7.1}/gpuNUFFT.egg-info/dependency_links.txt +0 -0
- {gpuNUFFT-0.6.3/CUDA/bin → gpuNUFFT-0.7.1}/gpuNUFFT.egg-info/not-zip-safe +0 -0
- {gpuNUFFT-0.6.3/CUDA/bin → gpuNUFFT-0.7.1}/gpuNUFFT.egg-info/top_level.txt +0 -0
- {gpuNUFFT-0.6.3 → gpuNUFFT-0.7.1}/setup.cfg +0 -0
|
@@ -415,4 +415,6 @@ void performPadding(DType2 *imdata_d, CufftType *gdata_d,
|
|
|
415
415
|
*/
|
|
416
416
|
void precomputeDeapodization(DType *deapo_d, gpuNUFFT::GpuNUFFTInfo *gi_host);
|
|
417
417
|
|
|
418
|
+
void performUpdateDensityComp(DType2* density_data, DType2* estimation_data, long int n_samples);
|
|
419
|
+
|
|
418
420
|
#endif
|
|
@@ -11,10 +11,11 @@ set(GPU_CU_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/atomic_gpuNUFFT.cu
|
|
|
11
11
|
#${CMAKE_CURRENT_SOURCE_DIR}/../std_gpuNUFFT_kernels.cu
|
|
12
12
|
)
|
|
13
13
|
if(WIN32)
|
|
14
|
-
CUDA_ADD_LIBRARY(${GRID_LIB_ATM_NAME} ${GPU_CU_SOURCES} ${GPU_GPUNUFFT_SOURCES} ${GPUNUFFT_SOURCES} ${GPUNUFFT_INCLUDE})
|
|
14
|
+
CUDA_ADD_LIBRARY(${GRID_LIB_ATM_NAME} ${GPU_CU_SOURCES} ${GPU_GPUNUFFT_SOURCES} ${GPUNUFFT_SOURCES} ${GPUNUFFT_INCLUDE} )
|
|
15
15
|
else(WIN32)
|
|
16
|
-
CUDA_ADD_LIBRARY(${GRID_LIB_ATM_NAME} ${GPU_CU_SOURCES} ${GPU_GPUNUFFT_SOURCES} ${GPUNUFFT_SOURCES} ${GPUNUFFT_INCLUDE}
|
|
16
|
+
CUDA_ADD_LIBRARY(${GRID_LIB_ATM_NAME} ${GPU_CU_SOURCES} ${GPU_GPUNUFFT_SOURCES} ${GPUNUFFT_SOURCES} ${GPUNUFFT_INCLUDE} SHARED)
|
|
17
17
|
endif(WIN32)
|
|
18
18
|
|
|
19
19
|
CUDA_ADD_CUFFT_TO_TARGET(${GRID_LIB_ATM_NAME})
|
|
20
20
|
CUDA_ADD_CUBLAS_TO_TARGET(${GRID_LIB_ATM_NAME})
|
|
21
|
+
target_link_libraries(${GRID_LIB_ATM_NAME} ${CUDA_curand_LIBRARY})
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.15)
|
|
2
|
-
find_package(
|
|
3
|
-
|
|
2
|
+
find_package(Python3 3.8 REQUIRED COMPONENTS Interpreter Development)
|
|
3
|
+
|
|
4
4
|
MESSAGE(STATUS "Building Python interface")
|
|
5
|
+
MESSAGE("Pybind11 include dir ${PYBIND11_INCLUDE_DIR}")
|
|
6
|
+
MESSAGE("Python include dir ${Python3_INCLUDE_DIRS}")
|
|
7
|
+
MESSAGE("Found ${Python3_LIBRARIES}")
|
|
5
8
|
|
|
6
9
|
include_directories(
|
|
7
10
|
${GPUNUFFT_INC_DIR}
|
|
8
11
|
${PYBIND11_INCLUDE_DIR}
|
|
9
|
-
${
|
|
12
|
+
${Python3_INCLUDE_DIRS}
|
|
10
13
|
)
|
|
11
14
|
cuda_include_directories(${GPUNUFFT_INC_DIR})
|
|
12
15
|
cuda_add_library(gpuNUFFT ${GPU_CU_SOURCES} ${GPU_GPUNUFFT_SOURCES} ${GPUNUFFT_SOURCES} ${GPUNUFFT_INCLUDE} gpuNUFFT_operator_python_factory.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../atomic/atomic_gpuNUFFT.cu SHARED)
|
|
13
16
|
set_target_properties(gpuNUFFT PROPERTIES PREFIX "")
|
|
14
17
|
|
|
18
|
+
|
|
15
19
|
if(WIN32)
|
|
16
|
-
MESSAGE("Pybind11 include dir ${PYBIND11_INCLUDE_DIR}")
|
|
17
|
-
MESSAGE("Python include dir ${PYTHON_INCLUDE_DIR}")
|
|
18
|
-
MESSAGE("Found ${PYTHON_LIBRARIES}")
|
|
19
20
|
set_target_properties(gpuNUFFT PROPERTIES SUFFIX ".pyd")
|
|
20
21
|
|
|
21
|
-
TARGET_LINK_LIBRARIES(gpuNUFFT ${CUDA_LIBRARIES} ${GRID_LIB_ATM_NAME} ${
|
|
22
|
+
TARGET_LINK_LIBRARIES(gpuNUFFT ${CUDA_LIBRARIES} ${GRID_LIB_ATM_NAME} ${Python3_LIBRARIES})
|
|
22
23
|
elseif(UNIX)
|
|
23
24
|
TARGET_LINK_LIBRARIES(gpuNUFFT ${CUDA_LIBRARIES})
|
|
24
25
|
endif(WIN32)
|
|
25
26
|
CUDA_ADD_CUFFT_TO_TARGET(gpuNUFFT)
|
|
26
27
|
CUDA_ADD_CUBLAS_TO_TARGET(gpuNUFFT)
|
|
28
|
+
target_link_libraries(gpuNUFFT ${CUDA_curand_LIBRARY})
|
|
29
|
+
|
|
@@ -14,13 +14,16 @@ Carole Lazarus <carole.m.lazarus@gmail.com>
|
|
|
14
14
|
#include "cufft.h"
|
|
15
15
|
#include "cuda_runtime.h"
|
|
16
16
|
#include <cuda.h>
|
|
17
|
-
#include <
|
|
17
|
+
#include <cublas_v2.h>
|
|
18
|
+
#include <curand.h>
|
|
18
19
|
#include "config.hpp"
|
|
19
20
|
#include "gpuNUFFT_operator_factory.hpp"
|
|
20
21
|
#include <algorithm> // std::sort
|
|
21
22
|
#include <vector> // std::vector
|
|
22
23
|
#include <string>
|
|
23
24
|
#include <cuda.h>
|
|
25
|
+
#include <cstdint>
|
|
26
|
+
|
|
24
27
|
#define CAST_POINTER_VARNAME(x, y) cast_pointer(x, y, #x)
|
|
25
28
|
|
|
26
29
|
namespace py = pybind11;
|
|
@@ -62,9 +65,10 @@ void warn_pinned_memory(py::array_t<std::complex<DType>> array, const char * nam
|
|
|
62
65
|
std::cerr<<"WARNING:: The data"<<name<<"is NOT pinned! This will be slow, consider pinning\n";
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
template <typename TType>
|
|
69
|
+
void allocate_pinned_memory(gpuNUFFT::Array<TType> *lin_array, unsigned long int size)
|
|
66
70
|
{
|
|
67
|
-
|
|
71
|
+
TType *new_data;
|
|
68
72
|
cudaMallocHost((void **)&new_data, size);
|
|
69
73
|
lin_array->data = new_data;
|
|
70
74
|
}
|
|
@@ -106,7 +110,9 @@ class GpuNUFFTPythonOperator
|
|
|
106
110
|
bool has_sense_data;
|
|
107
111
|
gpuNUFFT::Dimensions imgDims;
|
|
108
112
|
// sensitivity maps
|
|
109
|
-
gpuNUFFT::
|
|
113
|
+
gpuNUFFT::GpuArray<DType2> image_gpu;
|
|
114
|
+
gpuNUFFT::GpuArray<CufftType> kspace_data_gpu;
|
|
115
|
+
gpuNUFFT::Array<CufftType> sensArray, kspace_data, image;
|
|
110
116
|
void allocate_memory_kspace()
|
|
111
117
|
{
|
|
112
118
|
allocate_pinned_memory(&kspace_data, n_coils*trajectory_length*sizeof(DType2));
|
|
@@ -122,8 +128,8 @@ class GpuNUFFTPythonOperator
|
|
|
122
128
|
|
|
123
129
|
public:
|
|
124
130
|
GpuNUFFTPythonOperator(py::array_t<DType> kspace_loc, py::array_t<int> image_size, int num_coils,
|
|
125
|
-
py::array_t<std::complex<DType>> sense_maps,
|
|
126
|
-
int sector_width=8,
|
|
131
|
+
py::array_t<std::complex<DType>> sense_maps, py::array_t<DType> density_comp, int kernel_width=3,
|
|
132
|
+
int sector_width=8, float osr=2, bool balance_workload=1)
|
|
127
133
|
{
|
|
128
134
|
// k-space coordinates
|
|
129
135
|
py::buffer_info sample_loc = kspace_loc.request();
|
|
@@ -134,12 +140,12 @@ class GpuNUFFTPythonOperator
|
|
|
134
140
|
|
|
135
141
|
// density compensation weights
|
|
136
142
|
gpuNUFFT::Array<DType> density_compArray;
|
|
137
|
-
if(density_comp.has_value())
|
|
138
|
-
{
|
|
139
|
-
density_compArray = readNumpyArray(density_comp
|
|
143
|
+
//if(density_comp.has_value())
|
|
144
|
+
//{
|
|
145
|
+
density_compArray = readNumpyArray(density_comp);
|
|
140
146
|
density_compArray.dim.length = trajectory_length;
|
|
141
147
|
// No need else as the init is by default with 0 length and density comp is not applied
|
|
142
|
-
}
|
|
148
|
+
//}
|
|
143
149
|
|
|
144
150
|
// image size
|
|
145
151
|
py::buffer_info img_dim = image_size.request();
|
|
@@ -157,7 +163,10 @@ class GpuNUFFTPythonOperator
|
|
|
157
163
|
kspace_data.dim.length = trajectory_length;
|
|
158
164
|
kspace_data.dim.channels = num_coils;
|
|
159
165
|
image.dim = imgDims;
|
|
160
|
-
|
|
166
|
+
kspace_data_gpu.dim.length = trajectory_length;
|
|
167
|
+
kspace_data_gpu.dim.channels = num_coils;
|
|
168
|
+
image_gpu.dim = imgDims;
|
|
169
|
+
|
|
161
170
|
// sensitivity maps
|
|
162
171
|
py::buffer_info sense_maps_buffer = sense_maps.request();
|
|
163
172
|
if (sense_maps_buffer.shape.size()==0)
|
|
@@ -176,7 +185,6 @@ class GpuNUFFTPythonOperator
|
|
|
176
185
|
gpuNUFFTOp = factory.createGpuNUFFTOperator(
|
|
177
186
|
kSpaceTraj, density_compArray, sensArray, kernel_width, sector_width,
|
|
178
187
|
osr, imgDims);
|
|
179
|
-
|
|
180
188
|
if(has_sense_data == false)
|
|
181
189
|
image.dim.channels = n_coils;
|
|
182
190
|
else
|
|
@@ -206,6 +214,29 @@ class GpuNUFFTPythonOperator
|
|
|
206
214
|
capsule
|
|
207
215
|
);
|
|
208
216
|
}
|
|
217
|
+
|
|
218
|
+
void op_direct(uintptr_t in_image, uintptr_t out_kspace, bool interpolate_data)
|
|
219
|
+
{
|
|
220
|
+
image_gpu.data = (DType2*) in_image;
|
|
221
|
+
kspace_data_gpu.data = (CufftType*) out_kspace;
|
|
222
|
+
if(interpolate_data)
|
|
223
|
+
gpuNUFFTOp->performForwardGpuNUFFT(image_gpu, kspace_data_gpu, gpuNUFFT::DENSITY_ESTIMATION);
|
|
224
|
+
else
|
|
225
|
+
gpuNUFFTOp->performForwardGpuNUFFT(image_gpu, kspace_data_gpu);
|
|
226
|
+
cudaDeviceSynchronize();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
void adj_op_direct(uintptr_t in_kspace, uintptr_t out_image, bool grid_data)
|
|
230
|
+
{
|
|
231
|
+
kspace_data_gpu.data = (CufftType*) in_kspace;
|
|
232
|
+
image_gpu.data = (DType2*) out_image;
|
|
233
|
+
if(grid_data)
|
|
234
|
+
gpuNUFFTOp->performGpuNUFFTAdj(kspace_data_gpu, image_gpu, gpuNUFFT::DENSITY_ESTIMATION);
|
|
235
|
+
else
|
|
236
|
+
gpuNUFFTOp->performGpuNUFFTAdj(kspace_data_gpu, image_gpu);
|
|
237
|
+
cudaDeviceSynchronize();
|
|
238
|
+
}
|
|
239
|
+
|
|
209
240
|
py::array_t<std::complex<DType>> adj_op(py::array_t<std::complex<DType>> in_kspace, py::array_t<std::complex<DType>> out_image, bool grid_data)
|
|
210
241
|
{
|
|
211
242
|
CAST_POINTER_VARNAME(in_kspace, kspace_data);
|
|
@@ -266,6 +297,129 @@ class GpuNUFFTPythonOperator
|
|
|
266
297
|
has_sense_data = true;
|
|
267
298
|
gpuNUFFTOp->setSens(sensArray);
|
|
268
299
|
}
|
|
300
|
+
|
|
301
|
+
py::array_t<DType> estimate_density_comp(int max_iter = 10)
|
|
302
|
+
{
|
|
303
|
+
IndType n_samples = kspace_data.count();
|
|
304
|
+
gpuNUFFT::Array<CufftType> densArray;
|
|
305
|
+
allocate_pinned_memory(&densArray, n_samples * sizeof(CufftType));
|
|
306
|
+
densArray.dim.length = n_samples;
|
|
307
|
+
|
|
308
|
+
// TODO: Allocate directly on device and set with kernel.
|
|
309
|
+
for (long int cnt = 0; cnt < n_samples; cnt++)
|
|
310
|
+
{
|
|
311
|
+
densArray.data[cnt].x = 1.0;
|
|
312
|
+
densArray.data[cnt].y = 0.0;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
gpuNUFFT::GpuArray<DType2> densArray_gpu;
|
|
316
|
+
densArray_gpu.dim.length = n_samples;
|
|
317
|
+
allocateDeviceMem(&densArray_gpu.data, n_samples);
|
|
318
|
+
|
|
319
|
+
copyToDeviceAsync(densArray.data, densArray_gpu.data, n_samples);
|
|
320
|
+
|
|
321
|
+
gpuNUFFT::GpuArray<CufftType> densEstimation_gpu;
|
|
322
|
+
densEstimation_gpu.dim.length = n_samples;
|
|
323
|
+
allocateDeviceMem(&densEstimation_gpu.data, n_samples);
|
|
324
|
+
|
|
325
|
+
gpuNUFFT::GpuArray<CufftType> image_gpu;
|
|
326
|
+
image_gpu.dim = imgDims;
|
|
327
|
+
allocateDeviceMem(&image_gpu.data, imgDims.count());
|
|
328
|
+
|
|
329
|
+
if (DEBUG && (cudaDeviceSynchronize() != cudaSuccess))
|
|
330
|
+
printf("error at adj thread synchronization a: %s\n",
|
|
331
|
+
cudaGetErrorString(cudaGetLastError()));
|
|
332
|
+
for (int cnt = 0; cnt < max_iter; cnt++)
|
|
333
|
+
{
|
|
334
|
+
if (DEBUG)
|
|
335
|
+
printf("### update %i\n", cnt);
|
|
336
|
+
gpuNUFFTOp->performGpuNUFFTAdj(densArray_gpu, image_gpu,
|
|
337
|
+
gpuNUFFT::DENSITY_ESTIMATION);
|
|
338
|
+
gpuNUFFTOp->performForwardGpuNUFFT(image_gpu, densEstimation_gpu,
|
|
339
|
+
gpuNUFFT::DENSITY_ESTIMATION);
|
|
340
|
+
performUpdateDensityComp(densArray_gpu.data, densEstimation_gpu.data, n_samples);
|
|
341
|
+
if (DEBUG && (cudaDeviceSynchronize() != cudaSuccess))
|
|
342
|
+
printf("error at adj thread synchronization d: %s\n",
|
|
343
|
+
cudaGetErrorString(cudaGetLastError()));
|
|
344
|
+
}
|
|
345
|
+
freeDeviceMem(densEstimation_gpu.data);
|
|
346
|
+
freeDeviceMem(image_gpu.data);
|
|
347
|
+
|
|
348
|
+
cudaDeviceSynchronize();
|
|
349
|
+
// copy only the real part back to cpu
|
|
350
|
+
DType *tmp_d = (DType *)densArray_gpu.data;
|
|
351
|
+
|
|
352
|
+
gpuNUFFT::Array<DType> final_densArray;
|
|
353
|
+
final_densArray.dim.length = n_samples;
|
|
354
|
+
allocate_pinned_memory(&final_densArray, n_samples * sizeof(DType));
|
|
355
|
+
HANDLE_ERROR(cudaMemcpy2DAsync(final_densArray.data, sizeof(DType),
|
|
356
|
+
tmp_d, sizeof(DType2), sizeof(DType),
|
|
357
|
+
n_samples, cudaMemcpyDeviceToHost));
|
|
358
|
+
cudaDeviceSynchronize();
|
|
359
|
+
freeDeviceMem(densArray_gpu.data);
|
|
360
|
+
DType *ptr = reinterpret_cast<DType(&)[0]>(*final_densArray.data);
|
|
361
|
+
auto capsule = py::capsule(ptr, [](void *ptr) { return; });
|
|
362
|
+
return py::array_t<DType>({ trajectory_length }, { sizeof(DType) }, ptr,
|
|
363
|
+
capsule);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
float get_spectral_radius(int max_iter = 20,float tolerance = 1e-6)
|
|
370
|
+
{
|
|
371
|
+
int im_size = image.count();
|
|
372
|
+
|
|
373
|
+
gpuNUFFT::GpuArray<DType2> x_gpu;
|
|
374
|
+
x_gpu.dim = image.dim;
|
|
375
|
+
allocateDeviceMem(&x_gpu.data, im_size);
|
|
376
|
+
|
|
377
|
+
gpuNUFFT::GpuArray<DType2> tmp_kspace_gpu;
|
|
378
|
+
tmp_kspace_gpu.dim = kspace_data.dim;
|
|
379
|
+
allocateDeviceMem(&tmp_kspace_gpu.data, kspace_data.count());
|
|
380
|
+
|
|
381
|
+
cudaDeviceSynchronize();
|
|
382
|
+
DType norm_old = 1.0;
|
|
383
|
+
DType norm_new = 1.0;
|
|
384
|
+
DType inv_norm = 1.0;
|
|
385
|
+
// initialisation: create a random complex image.
|
|
386
|
+
curandGenerator_t generator;
|
|
387
|
+
curandCreateGenerator(&generator, CURAND_RNG_PSEUDO_XORWOW);
|
|
388
|
+
curandSetPseudoRandomGeneratorSeed(generator, (int)time(NULL));
|
|
389
|
+
|
|
390
|
+
// complex value generator by giving twice the size.
|
|
391
|
+
curandGenerateUniform(generator, (DType *)x_gpu.data, 2 * im_size);
|
|
392
|
+
// xold = initialize random x of image size.
|
|
393
|
+
curandDestroyGenerator(generator);
|
|
394
|
+
// Create a handle
|
|
395
|
+
cublasHandle_t handle;
|
|
396
|
+
cublasCreate(&handle);
|
|
397
|
+
|
|
398
|
+
cublasScnrm2(handle, im_size, x_gpu.data, 1, &norm_old);
|
|
399
|
+
inv_norm = 1.0 / norm_old;
|
|
400
|
+
cublasCsscal(handle, im_size, &inv_norm, x_gpu.data, 1);
|
|
401
|
+
|
|
402
|
+
for (int i = 0; i < max_iter; i++)
|
|
403
|
+
{
|
|
404
|
+
// compute x_new = adj_op(op(x_old))
|
|
405
|
+
gpuNUFFTOp->performForwardGpuNUFFT(x_gpu, tmp_kspace_gpu);
|
|
406
|
+
gpuNUFFTOp->performGpuNUFFTAdj(tmp_kspace_gpu, x_gpu);
|
|
407
|
+
// compute ||x_new||
|
|
408
|
+
cublasScnrm2(handle, im_size, x_gpu.data, 1, &norm_new);
|
|
409
|
+
// x_new <- x_new/ ||x_new||
|
|
410
|
+
inv_norm = 1.0 / norm_new;
|
|
411
|
+
|
|
412
|
+
cublasCsscal(handle, im_size, &inv_norm, x_gpu.data, 1);
|
|
413
|
+
if (fabs(norm_new - norm_old) < tolerance)
|
|
414
|
+
{
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
norm_old = norm_new;
|
|
418
|
+
}
|
|
419
|
+
freeTotalDeviceMemory(tmp_kspace_gpu.data, x_gpu.data, NULL);
|
|
420
|
+
cublasDestroy(handle);
|
|
421
|
+
return norm_new;
|
|
422
|
+
}
|
|
269
423
|
~GpuNUFFTPythonOperator()
|
|
270
424
|
{
|
|
271
425
|
delete gpuNUFFTOp;
|
|
@@ -274,12 +428,15 @@ class GpuNUFFTPythonOperator
|
|
|
274
428
|
|
|
275
429
|
PYBIND11_MODULE(gpuNUFFT, m) {
|
|
276
430
|
py::class_<GpuNUFFTPythonOperator>(m, "NUFFTOp")
|
|
277
|
-
.def(py::init<py::array_t<DType>, py::array_t<int>, int, py::array_t<std::complex<DType>>,
|
|
431
|
+
.def(py::init<py::array_t<DType>, py::array_t<int>, int, py::array_t<std::complex<DType>>, py::array_t<DType>, int, int, float, bool>(),
|
|
278
432
|
py::arg("kspace_loc"), py::arg("image_size"), py::arg("num_coils"), py::arg("sense_maps") = py::none(), py::arg("density_comp") = py::none(), py::arg("kernel_width") = 3, py::arg("sector_width") = 8, py::arg("osr") = 2, py::arg("balance_workload") = true)
|
|
279
433
|
.def("op", &GpuNUFFTPythonOperator::op, py::arg("in_image"), py::arg("out_kspace"), py::arg("interpolate_data") = false)
|
|
434
|
+
.def("op_direct", &GpuNUFFTPythonOperator::op_direct, py::arg("in_image"), py::arg("out_kspace"), py::arg("interpolate_data") = false)
|
|
435
|
+
.def("adj_op_direct", &GpuNUFFTPythonOperator::adj_op_direct, py::arg("in_kspace"), py::arg("out_image"), py::arg("grid_data") = false)
|
|
280
436
|
.def("adj_op", &GpuNUFFTPythonOperator::adj_op, py::arg("in_kspace"), py::arg("out_image"), py::arg("grid_data") = false)
|
|
281
437
|
.def("clean_memory", &GpuNUFFTPythonOperator::clean_memory)
|
|
282
|
-
.def("
|
|
283
|
-
|
|
438
|
+
.def("estimate_density_comp", &GpuNUFFTPythonOperator::estimate_density_comp, py::arg("max_iter") = 10)
|
|
439
|
+
.def("set_smaps", &GpuNUFFTPythonOperator::set_smaps)
|
|
440
|
+
.def("get_spectral_radius", &GpuNUFFTPythonOperator::get_spectral_radius, py::arg("max_iter") = 20, py::arg("tolerance") = 1e-6);
|
|
284
441
|
}
|
|
285
|
-
#endif //
|
|
442
|
+
#endif // GPUNUFFT_OPERATOR_PYTHONFACTORY_H_INCLUDED
|
|
@@ -33,6 +33,25 @@ void bindTo1DTexture(const char* symbol, void* devicePtr, IndType count)
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
__global__ void updateDensityCompKernel(DType2* density_data, DType2* estimation_data, long int N)
|
|
37
|
+
{
|
|
38
|
+
long int t = threadIdx.x + blockIdx.x * blockDim.x;
|
|
39
|
+
while (t < N)
|
|
40
|
+
{
|
|
41
|
+
DType2 data_p = density_data[t];
|
|
42
|
+
DType2 esti_p = estimation_data[t];
|
|
43
|
+
data_p.x *= rsqrtf(esti_p.x * esti_p.x + esti_p.y * esti_p.y);
|
|
44
|
+
density_data[t] = data_p;
|
|
45
|
+
t = t + blockDim.x*gridDim.x;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void performUpdateDensityComp(DType2* density_data, DType2* estimation_data, long int n_samples)
|
|
50
|
+
{
|
|
51
|
+
dim3 block_dim(64, 1, 8);
|
|
52
|
+
dim3 grid_dim(getOptimalGridDim(n_samples,THREAD_BLOCK_SIZE));
|
|
53
|
+
updateDensityCompKernel<<<grid_dim,block_dim>>>(density_data, estimation_data, n_samples);
|
|
54
|
+
}
|
|
36
55
|
|
|
37
56
|
void initTexture(const char* symbol, cudaArray** devicePtr, gpuNUFFT::Array<DType> hostTexture)
|
|
38
57
|
{
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
setup.py
|
|
5
|
+
CUDA/CMakeLists.txt
|
|
6
|
+
CUDA/doc/CMakeLists.txt
|
|
7
|
+
CUDA/doc/Doxyfile
|
|
8
|
+
CUDA/doc/mainpage.dox
|
|
9
|
+
CUDA/inc/balanced_gpuNUFFT_operator.hpp
|
|
10
|
+
CUDA/inc/balanced_operator.hpp
|
|
11
|
+
CUDA/inc/balanced_texture_gpuNUFFT_operator.hpp
|
|
12
|
+
CUDA/inc/config.hpp
|
|
13
|
+
CUDA/inc/config.hpp.cmake
|
|
14
|
+
CUDA/inc/cuda_utils.cuh
|
|
15
|
+
CUDA/inc/cuda_utils.hpp
|
|
16
|
+
CUDA/inc/cufft_config.hpp
|
|
17
|
+
CUDA/inc/cufft_config.hpp.cmake
|
|
18
|
+
CUDA/inc/gpuNUFFT_cpu.hpp
|
|
19
|
+
CUDA/inc/gpuNUFFT_kernels.hpp
|
|
20
|
+
CUDA/inc/gpuNUFFT_operator.hpp
|
|
21
|
+
CUDA/inc/gpuNUFFT_operator_factory.hpp
|
|
22
|
+
CUDA/inc/gpuNUFFT_types.hpp
|
|
23
|
+
CUDA/inc/gpuNUFFT_utils.hpp
|
|
24
|
+
CUDA/inc/matlab_helper.h
|
|
25
|
+
CUDA/inc/precomp_kernels.hpp
|
|
26
|
+
CUDA/inc/precomp_utils.hpp
|
|
27
|
+
CUDA/inc/texture_gpuNUFFT_operator.hpp
|
|
28
|
+
CUDA/src/CMakeLists.txt
|
|
29
|
+
CUDA/src/balanced_gpuNUFFT_operator.cpp
|
|
30
|
+
CUDA/src/balanced_texture_gpuNUFFT_operator.cpp
|
|
31
|
+
CUDA/src/gpuNUFFT_operator.cpp
|
|
32
|
+
CUDA/src/gpuNUFFT_operator_factory.cpp
|
|
33
|
+
CUDA/src/gpuNUFFT_utils.cpp
|
|
34
|
+
CUDA/src/texture_gpuNUFFT_operator.cpp
|
|
35
|
+
CUDA/src/cpu/gpuNUFFT_cpu.cpp
|
|
36
|
+
CUDA/src/gpu/CMakeLists.txt
|
|
37
|
+
CUDA/src/gpu/precomp_kernels.cu
|
|
38
|
+
CUDA/src/gpu/std_gpuNUFFT_kernels.cu
|
|
39
|
+
CUDA/src/gpu/atomic/CMakeLists.txt
|
|
40
|
+
CUDA/src/gpu/atomic/atomic_gpuNUFFT.cu
|
|
41
|
+
CUDA/src/gpu/atomic/atomic_gpuNUFFT_kernels.cu
|
|
42
|
+
CUDA/src/gpu/atomic/texture_gpuNUFFT_kernels.cu
|
|
43
|
+
CUDA/src/gpu/matlab/CMakeLists.txt
|
|
44
|
+
CUDA/src/gpu/matlab/gpuNUFFT_adj.cpp
|
|
45
|
+
CUDA/src/gpu/matlab/gpuNUFFT_forw.cpp
|
|
46
|
+
CUDA/src/gpu/matlab/gpuNUFFT_operator_matlabfactory.cpp
|
|
47
|
+
CUDA/src/gpu/matlab/gpuNUFFT_operator_matlabfactory.hpp
|
|
48
|
+
CUDA/src/gpu/matlab/precomputation/CMakeLists.txt
|
|
49
|
+
CUDA/src/gpu/matlab/precomputation/gpuNUFFT_precomp.cpp
|
|
50
|
+
CUDA/src/gpu/python/CMakeLists.txt
|
|
51
|
+
CUDA/src/gpu/python/gpuNUFFT_operator_python_factory.cpp
|
|
52
|
+
gpuNUFFT.egg-info/PKG-INFO
|
|
53
|
+
gpuNUFFT.egg-info/SOURCES.txt
|
|
54
|
+
gpuNUFFT.egg-info/dependency_links.txt
|
|
55
|
+
gpuNUFFT.egg-info/not-zip-safe
|
|
56
|
+
gpuNUFFT.egg-info/top_level.txt
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import sys
|
|
3
|
-
from setuptools import setup, Extension,
|
|
3
|
+
from setuptools import setup, Extension, find_namespace_packages
|
|
4
4
|
from setuptools.command.build_ext import build_ext
|
|
5
5
|
from importlib import import_module
|
|
6
6
|
import platform
|
|
@@ -21,6 +21,14 @@ class CMakeBuild(build_ext):
|
|
|
21
21
|
""" Define a cmake build extension.
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
|
+
@staticmethod
|
|
25
|
+
def _preinstall(package):
|
|
26
|
+
""" Pre-install PyPi packages before running cmake.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
subprocess.check_call(
|
|
30
|
+
[sys.executable, '-m', 'pip', 'install', package]
|
|
31
|
+
)
|
|
24
32
|
|
|
25
33
|
|
|
26
34
|
def _set_pybind_path(self):
|
|
@@ -34,6 +42,8 @@ class CMakeBuild(build_ext):
|
|
|
34
42
|
# Set preinstall requirements
|
|
35
43
|
preinstall = "pybind11"
|
|
36
44
|
|
|
45
|
+
# Preinstall packages
|
|
46
|
+
self._preinstall(preinstall)
|
|
37
47
|
|
|
38
48
|
# Set Pybind11 path
|
|
39
49
|
self._set_pybind_path()
|
|
@@ -93,9 +103,8 @@ class CMakeBuild(build_ext):
|
|
|
93
103
|
|
|
94
104
|
setup(
|
|
95
105
|
name="gpuNUFFT",
|
|
96
|
-
version="0.
|
|
106
|
+
version="0.7.1",
|
|
97
107
|
description="gpuNUFFT - An open source GPU Library for 3D Gridding and NUFFT",
|
|
98
|
-
package_dir={"": "CUDA/bin"},
|
|
99
108
|
ext_modules=[
|
|
100
109
|
CMakeExtension("gpuNUFFT", sourcedir=os.path.join("CUDA")),
|
|
101
110
|
],
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE cvp>
|
|
2
|
-
<cvp version="4.0" >
|
|
3
|
-
<session>
|
|
4
|
-
<name>Session1</name>
|
|
5
|
-
<progpath>"E:/Andi/workspaces/cuda/cuda-test/gridding3D/gridding3D/bin/runGPUUnitTests.exe"</progpath>
|
|
6
|
-
<workdirpath>E:/Andi/workspaces/cuda/cuda-test/gridding3D/gridding3D/bin</workdirpath>
|
|
7
|
-
<datetime>16 Aug 2012 16:01:37</datetime>
|
|
8
|
-
<normalizedcounter>false</normalizedcounter>
|
|
9
|
-
<device multProcessorCount="2" label="Device_0" id="0" computeCapability="1.1" maxGridDim="65535 65535" GpuOverlap="0" maxPitchMem="2147483647" totalConstMem="65536" name="GeForce 9500M (GF 9400MG + GF 9200MGS)" clockFreq="1100000" L2CacheSize="0" maxRegPerBlock="8192" chip="172" maxThreadPerSM="768" maxShareMemPerBlock="16384" maxBlockDim="512 512 64" MemClockRate="1064000" asyncEngineCount="0" warpSize="32" maxThreadPerBlock="512" MemBandwidth="272384000" textureAlignment="256" >
|
|
10
|
-
<context totalcountercount="0" invalidcountercount="0" id="0" label="Context_0" truncatedcountercount="0" trace="0" >
|
|
11
|
-
<run number="2" >branch,divergent_branch,instructions,warp_serialize</run>
|
|
12
|
-
<run number="3" >cta_launched,gld_incoherent,gld_coherent,gst_incoherent</run>
|
|
13
|
-
<run number="4" >gst_coherent,local_load,local_store</run>
|
|
14
|
-
<run number="5" >tex_cache_hit,tex_cache_miss</run>
|
|
15
|
-
</context>
|
|
16
|
-
</device>
|
|
17
|
-
</session>
|
|
18
|
-
<session>
|
|
19
|
-
<name>Session2</name>
|
|
20
|
-
<progpath>"E:/Andi/workspaces/cuda/cuda-test/gridding3D/gridding3D/bin/runGPUUnitTests.exe"</progpath>
|
|
21
|
-
<workdirpath>E:/Andi/workspaces/cuda/cuda-test/gridding3D/gridding3D/bin</workdirpath>
|
|
22
|
-
<datetime>16 Aug 2012 19:25:24</datetime>
|
|
23
|
-
<normalizedcounter>false</normalizedcounter>
|
|
24
|
-
<device multProcessorCount="2" label="Device_0" id="0" computeCapability="1.1" maxGridDim="65535 65535" GpuOverlap="0" maxPitchMem="2147483647" totalConstMem="65536" name="GeForce 9500M (GF 9400MG + GF 9200MGS)" clockFreq="1100000" L2CacheSize="0" maxRegPerBlock="8192" chip="172" maxThreadPerSM="768" maxShareMemPerBlock="16384" maxBlockDim="512 512 64" MemClockRate="1064000" asyncEngineCount="0" warpSize="32" maxThreadPerBlock="512" MemBandwidth="272384000" textureAlignment="256" >
|
|
25
|
-
<context totalcountercount="0" invalidcountercount="0" id="0" label="Context_0" truncatedcountercount="0" trace="0" >
|
|
26
|
-
<run number="2" >branch,divergent_branch,instructions,warp_serialize</run>
|
|
27
|
-
<run number="3" >cta_launched,gld_incoherent,gld_coherent,gst_incoherent</run>
|
|
28
|
-
<run number="4" >gst_coherent,local_load,local_store</run>
|
|
29
|
-
<run number="5" >tex_cache_hit,tex_cache_miss</run>
|
|
30
|
-
</context>
|
|
31
|
-
</device>
|
|
32
|
-
</session>
|
|
33
|
-
</cvp>
|
|
34
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
runUnitTests.exe --gtest_filter=TestGridding.CPUTest_8SectorsKernel3nDataw32 --gtest_repeat=100 --gtest_break_on_failure
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
runGPUUnitTests.exe --gtest_filter=TestGridding.GPUTest_8SectorsKernel3nDataw32 --gtest_repeat=100 --gtest_break_on_failure
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
cmake -G "Visual Studio 10" .. -DGPU_DOUBLE_PREC=ON
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
cmake -G "Visual Studio 10" ..
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
INCLUDE(FindPackageHandleStandardArgs)
|
|
2
|
-
|
|
3
|
-
IF (NOT DEFINED GPUNUFFT_ROOT_DIR)
|
|
4
|
-
MESSAGE(FATAL_ERROR "GPUNUFFT_ROOT_DIR not defined!")
|
|
5
|
-
ELSE()
|
|
6
|
-
MESSAGE("Searching for GPUNUFFT in ${GPUNUFFT_ROOT_DIR}")
|
|
7
|
-
|
|
8
|
-
SET(GPUNUFFT_IncludeSearchPaths ${GPUNUFFT_ROOT_DIR}/CUDA/inc ${GPUNUFFT_ROOT_DIR}/inc) #/usr/local/include
|
|
9
|
-
SET(GPUNUFFT_LibrarySearchPaths ${GPUNUFFT_ROOT_DIR}/CUDA/bin ${GPUNUFFT_ROOT_DIR}/bin) #/usr/local/lib
|
|
10
|
-
|
|
11
|
-
FIND_PATH(GPUNUFFT_INCLUDE_DIRS NAMES gpuNUFFT_operator_factory.hpp PATHS ${GPUNUFFT_IncludeSearchPaths})
|
|
12
|
-
|
|
13
|
-
FIND_LIBRARY(GPUNUFFT_LIBRARIES NAMES gpuNUFFT gpuNUFFT_ATM_f gpuNUFFT_f PATHS ${GPUNUFFT_LibrarySearchPaths})
|
|
14
|
-
|
|
15
|
-
#Handle the REQUIRED argument and set the < UPPERCASED_NAME > _FOUND variable
|
|
16
|
-
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GPUNUFFT "Could NOT find GPUNUFFT." GPUNUFFT_LIBRARIES GPUNUFFT_INCLUDE_DIRS)
|
|
17
|
-
IF(GPUNUFFT_FOUND)
|
|
18
|
-
FIND_PACKAGE_MESSAGE(
|
|
19
|
-
GPUNUFFT
|
|
20
|
-
"Found GPUNUFFT ${GPUNUFFT_LIBRARIES}"
|
|
21
|
-
"[${GPUNUFFT_LIBRARIES}][${GPUNUFFT_INCLUDE_DIRS}]")
|
|
22
|
-
ENDIF(GPUNUFFT_FOUND)
|
|
23
|
-
MARK_AS_ADVANCED(GPUNUFFT_INCLUDE_DIRS GPUNUFFT_LIBRARIES)
|
|
24
|
-
ENDIF()
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#setup testframework
|
|
2
|
-
MESSAGE("------setting up testframework-------")
|
|
3
|
-
|
|
4
|
-
set(GTEST_DIR "${CMAKE_SOURCE_DIR}/../../gtest/googletest")
|
|
5
|
-
MESSAGE("GTEST_DIR " ${GTEST_DIR})
|
|
6
|
-
|
|
7
|
-
include_directories("${GTEST_DIR}/include")
|
|
8
|
-
|
|
9
|
-
find_library(GTEST_LIB NAMES gtest libgtest HINTS "${GTEST_DIR}/build" "${GTEST_DIR}/build/Debug")
|
|
10
|
-
find_library(GTESTMAIN_LIB NAMES gtest_main libgtest_main HINTS "${GTEST_DIR}/build" "${GTEST_DIR}/build/Debug")
|
|
11
|
-
|
|
12
|
-
MESSAGE("GTEST_LIB = ${GTEST_LIB}")
|
|
13
|
-
MESSAGE("GTESTMAIN_LIB = ${GTESTMAIN_LIB}")
|
|
14
|
-
|
|
15
|
-
#gpu test sources
|
|
16
|
-
set(GPU_SOURCES gpu/gpuNUFFT_conv_tests.cpp
|
|
17
|
-
gpu/gpuNUFFT_2D_conv_tests.cpp
|
|
18
|
-
gpu/gpuNUFFT_fft_tests.cpp
|
|
19
|
-
gpu/gpuNUFFT_deapo_tests.cpp
|
|
20
|
-
gpu/forward/gpuNUFFT_forward_tests.cpp)
|
|
21
|
-
|
|
22
|
-
#add CPU Tests
|
|
23
|
-
add_subdirectory(cpu)
|
|
24
|
-
|
|
25
|
-
cuda_add_executable(runGPUATMUnitTests ${GPU_SOURCES} ${GPUNUFFT_SOURCES} ../inc/gpuNUFFT_utils.hpp ../inc/gpuNUFFT_operator_factory.hpp ../inc/gpuNUFFT_operator.hpp ../inc/gpuNUFFT_kernels.hpp)
|
|
26
|
-
if(WIN32)
|
|
27
|
-
target_link_libraries(runGPUATMUnitTests ${GRID_LIB_ATM_NAME} ${GTEST_LIB} ${GTESTMAIN_LIB})
|
|
28
|
-
else(WIN32)
|
|
29
|
-
target_link_libraries(runGPUATMUnitTests pthread ${GRID_LIB_ATM_NAME} ${GTEST_LIB} ${GTESTMAIN_LIB})
|
|
30
|
-
endif(WIN32)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#setup testframework
|
|
2
|
-
MESSAGE("------ generating cpu tests -------")
|
|
3
|
-
|
|
4
|
-
#cpu test sources
|
|
5
|
-
set(CPU_SOURCES gpuNUFFT_tests.cpp
|
|
6
|
-
gpuNUFFT_kernel_tests.cpp
|
|
7
|
-
gpuNUFFT_precomputation_tests.cpp
|
|
8
|
-
gpuNUFFT_operator_factory_tests.cpp
|
|
9
|
-
../../src/gpuNUFFT_utils.cpp
|
|
10
|
-
../../src/cpu/gpuNUFFT_cpu.cpp)
|
|
11
|
-
|
|
12
|
-
include_directories(${CUDA_INCLUDE_DIRS})
|
|
13
|
-
#add source dir
|
|
14
|
-
add_executable(runUnitTests ${CPU_SOURCES} ${GPUNUFFT_SOURCES} ../../inc/gpuNUFFT_cpu.hpp ../../inc/gpuNUFFT_utils.hpp ../../inc/gpuNUFFT_operator_factory.hpp ../../inc/gpuNUFFT_operator.hpp ../../inc/gpuNUFFT_kernels.hpp)
|
|
15
|
-
target_link_libraries(runUnitTests ${GRID_LIB_ATM_NAME} ${GTEST_LIB} ${GTESTMAIN_LIB})
|
|
16
|
-
set_target_properties(runUnitTests PROPERTIES LINK_FLAGS -lpthread)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#include <limits.h>
|
|
2
|
-
#include "gpuNUFFT_cpu.hpp"
|
|
3
|
-
|
|
4
|
-
#include "gtest/gtest.h"
|
|
5
|
-
|
|
6
|
-
#define epsilon 0.0001f
|
|
7
|
-
|
|
8
|
-
TEST(TestKernel, LoadKernel) {
|
|
9
|
-
if (DEBUG)
|
|
10
|
-
printf("start creating kernel...\n");
|
|
11
|
-
long kernel_entries = calculateGrid3KernelSize();
|
|
12
|
-
|
|
13
|
-
assert(kernel_entries > 0);
|
|
14
|
-
|
|
15
|
-
DType *kern = (DType*) calloc(kernel_entries,sizeof(DType));
|
|
16
|
-
if (kern != NULL)
|
|
17
|
-
{
|
|
18
|
-
loadGrid3Kernel(kern,kernel_entries);
|
|
19
|
-
EXPECT_EQ(1.0f,kern[0]);
|
|
20
|
-
EXPECT_LT(0.9940f-kern[1],epsilon);
|
|
21
|
-
EXPECT_LT(0.0621f-kern[401],epsilon);
|
|
22
|
-
EXPECT_LT(0.0041f-kern[665],epsilon);
|
|
23
|
-
EXPECT_EQ(0.0f,kern[kernel_entries-1]);
|
|
24
|
-
free(kern);
|
|
25
|
-
}
|
|
26
|
-
EXPECT_EQ(1, 1);
|
|
27
|
-
}
|