Skip to content
Snippets Groups Projects
Commit 5630dc4d authored by Markus Holzer's avatar Markus Holzer Committed by Dominik Thoennes
Browse files

Replace PyCuda with CuPy

parent ffd3e95a
No related merge requests found
......@@ -420,7 +420,7 @@ gcc_8_serial:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -444,7 +444,7 @@ gcc_8_mpionly:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
......@@ -466,7 +466,7 @@ gcc_8_hybrid:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
......@@ -487,7 +487,7 @@ gcc_8_serial_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -512,7 +512,7 @@ gcc_8_mpionly_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -535,7 +535,7 @@ gcc_8_hybrid_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -557,7 +557,7 @@ gcc_8_hybrid_dbg_sp:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -582,7 +582,7 @@ gcc_9_serial:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -606,7 +606,7 @@ gcc_9_mpionly:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
......@@ -628,7 +628,7 @@ gcc_9_hybrid:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
......@@ -649,7 +649,7 @@ gcc_9_serial_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -674,7 +674,7 @@ gcc_9_mpionly_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -697,7 +697,7 @@ gcc_9_hybrid_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -719,7 +719,7 @@ gcc_9_hybrid_dbg_sp:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -744,7 +744,7 @@ gcc_10_serial:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -768,7 +768,7 @@ gcc_10_mpionly:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
......@@ -790,7 +790,7 @@ gcc_10_hybrid:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
......@@ -811,7 +811,7 @@ gcc_10_serial_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -836,7 +836,7 @@ gcc_10_mpionly_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -859,7 +859,7 @@ gcc_10_hybrid_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -881,7 +881,7 @@ gcc_10_hybrid_dbg_sp:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -906,7 +906,7 @@ gcc_11_serial:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -930,7 +930,7 @@ gcc_11_mpionly:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
......@@ -952,7 +952,7 @@ gcc_11_hybrid:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
......@@ -973,7 +973,7 @@ gcc_11_serial_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -998,7 +998,7 @@ gcc_11_mpionly_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1021,7 +1021,7 @@ gcc_11_hybrid_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1043,7 +1043,7 @@ gcc_11_hybrid_dbg_sp:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1348,7 +1348,7 @@ clang_11.0_serial:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -1372,7 +1372,7 @@ clang_11.0_mpionly:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
......@@ -1394,7 +1394,7 @@ clang_11.0_hybrid:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
......@@ -1415,7 +1415,7 @@ clang_11.0_serial_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -1440,7 +1440,7 @@ clang_11.0_mpionly_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1463,7 +1463,7 @@ clang_11.0_hybrid_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1485,7 +1485,7 @@ clang_11.0_hybrid_dbg_sp:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1510,7 +1510,7 @@ clang_12.0_serial:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -1534,7 +1534,7 @@ clang_12.0_mpionly:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
......@@ -1556,7 +1556,7 @@ clang_12.0_hybrid:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
......@@ -1577,7 +1577,7 @@ clang_12.0_serial_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -1602,7 +1602,7 @@ clang_12.0_mpionly_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1625,7 +1625,7 @@ clang_12.0_hybrid_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1647,7 +1647,7 @@ clang_12.0_hybrid_dbg_sp:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1672,7 +1672,7 @@ clang_13.0_serial:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -1696,7 +1696,7 @@ clang_13.0_mpionly:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_OPENMP: "OFF"
......@@ -1718,7 +1718,7 @@ clang_13.0_hybrid:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_CODEGEN: "ON"
......@@ -1736,7 +1736,7 @@ clang_13.0_serial_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
WALBERLA_BUILD_WITH_MPI: "OFF"
......@@ -1758,7 +1758,7 @@ clang_13.0_mpionly_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1778,7 +1778,7 @@ clang_13.0_hybrid_dbg:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......@@ -1798,7 +1798,7 @@ clang_13.0_hybrid_dbg_sp:
- python3 -m pytest --junitxml=report.xml pystencils_walberla lbmpy_walberla
- pip3 list
- cd ..
- CC=gcc CXX=g++ pip3 install pycuda
- CC=gcc CXX=g++ pip3 install cupy-cuda11x
variables:
WALBERLA_BUILD_WITH_CUDA: "ON"
CMAKE_BUILD_TYPE: "DebugOptimized"
......
......@@ -42,10 +42,10 @@ if cpp_available:
from .field_extension import extend as extend_field
extend_field(field) # noqa: F405
if 'cuda' in globals():
sys.modules[__name__ + '.cuda'] = cuda # noqa: F405
from .cuda_extension import extend as extend_cuda
extend_cuda(cuda) # noqa: F405
if 'gpu' in globals():
sys.modules[__name__ + '.gpu'] = gpu # noqa: F405
from .gpu_extension import extend as extend_gpu
extend_gpu(gpu) # noqa: F405
if 'mpi' in globals():
sys.modules[__name__ + '.mpi'] = mpi # noqa: F405
else:
......
from pycuda.gpuarray import GPUArray
import cupy as cp
from cupy.cuda import MemoryPointer, UnownedMemory
import numpy as np
from .field_extension import normalize_ghostlayer_info
def to_gpu_array(f, with_ghost_layers=True):
"""Converts a waLBerla GPUField to a pycuda GPUArray"""
"""Converts a waLBerla GPUField to a cupy ndarray"""
if not f:
return None
dtype = np.dtype(f.dtypeStr)
strides = [dtype.itemsize * a for a in f.strides]
res = GPUArray(f.sizeWithGhostLayers, dtype, gpudata=f.ptr, strides=strides)
allocated_bytes = np.prod(f.allocSize) * dtype.itemsize
memory_pointer = MemoryPointer(UnownedMemory(f.ptr, allocated_bytes, f), 0)
res = cp.ndarray(shape=f.sizeWithGhostLayers, dtype=dtype,
memptr=memory_pointer, strides=strides)
if with_ghost_layers is True:
return res
ghost_layers = normalize_ghostlayer_info(f, with_ghost_layers)
cutoff = [f.nrOfGhostLayers - gl for gl in ghost_layers]
res = res[cutoff[0]:-cutoff[0] if cutoff[0] > 0 else None,
cutoff[1]:-cutoff[1] if cutoff[1] > 0 else None,
cutoff[2]:-cutoff[2] if cutoff[2] > 0 else None,
:]
res = res[slice(cutoff[0], -cutoff[0], 1) if cutoff[0] > 0 else slice(None, None, None),
slice(cutoff[1], -cutoff[1], 1) if cutoff[1] > 0 else slice(None, None, None),
slice(cutoff[2], -cutoff[2], 1) if cutoff[2] > 0 else slice(None, None, None),
slice(None, None, None)]
return res
def extend(cpp_cuda_module):
cpp_cuda_module.toGpuArray = to_gpu_array
def extend(cpp_gpu_module):
cpp_gpu_module.toGpuArray = to_gpu_array
......@@ -52,7 +52,6 @@ using namespace pybind11::literals;
uint64_t gpufield_ptr(const GpuField_T & gpuField)
{
return reinterpret_cast<uint64_t>(gpuField.pitchedPtr().ptr);
// return gpuField.pitchedPtr();
}
template<typename GpuField_T>
......@@ -115,7 +114,7 @@ using namespace pybind11::literals;
py::object &dtype, uint_t fs, uint_t gl, Layout layout,
bool usePitchedMem )
: blocks_( blocks ), name_( name ), dtype_(dtype), fs_( fs ),
gl_(gl),layout_( layout), usePitchedMem_(usePitchedMem), found_(true)
gl_(gl),layout_( layout), usePitchedMem_(usePitchedMem)
{}
template< typename GpuField_T>
......@@ -138,7 +137,7 @@ using namespace pybind11::literals;
uint_t gl_;
Layout layout_;
bool usePitchedMem_;
bool found_;
bool found_{true};
};
template<typename... GpuFields>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment