Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/build_upload_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,44 @@ jobs:
if: ${{ matrix.os_base == 'macos'}}
run: sudo xcode-select --switch /Applications/Xcode_11.5.app/Contents/Developer

- name: Install CUDA (Windows)
if: ${{matrix.os_base == 'windows'}}
uses: Jimver/[email protected]
with:
cuda: '11.2.2'

- name: Build SplinePSF (UNIX)
if: ${{ matrix.os_base == 'ubuntu' || matrix.os_base == 'macos'}}
run: |
cd ./dist_tools/conda

conda-build -c conda-forge spline
conda-build -c conda-forge spline --output > $FILENAMES

- name: Build SplinePSF (Windows)
if: ${{ matrix.os_base == 'windows' }}
run: |
Set-Location -Path .\dist_tools\conda

$env:VSCMD_DEBUG=3
conda-build -c conda-forge spline
conda-build -c conda-forge spline --output > $Env:FILENAMES

- name: Upload CMake error log
uses: actions/upload-artifact@v2
with:
name: CMakeError.log
path: |
C:/Miniconda/envs/test/conda-bld/*/work/python/build/temp.win-amd64-3.*/Release/CMakeFiles/CMakeError.log
C:/Miniconda/envs/test/conda-bld/*/work/python/build/temp.win-amd64-3.*/Release/CMakeFiles/CMakeOutput.log

- name: Upload other CMake error log
uses: actions/upload-artifact@v2
with:
name: Other_CmakeError.log
path: |
**/python/build/**/Release/CMakeFiles/CMakeError.log
**/python/build/**/Release/CMakeFiles/CMakeOutput.log

- name: Change anaconda label on release
if: github.event.release
run: |
Expand Down
12 changes: 6 additions & 6 deletions cpp_cuda_c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
#cmake_policy(SET CMP0094 NEW)

project(SplinePSF LANGUAGES CXX C)
Expand All @@ -8,9 +8,9 @@ check_language(CUDA)

find_package(Python COMPONENTS Interpreter Development)
find_package(pybind11 REQUIRED)
find_package(CUDA)
find_package(CUDAToolkit)

if(CMAKE_CUDA_COMPILER AND NOT CUDA_DISABLED) # the latter is a user definable variable
if(CUDAToolkit_FOUND AND NOT CUDA_DISABLED) # the latter is a user definable variable
enable_language(CUDA)
add_compile_definitions(CUDA_ENABLED)

Expand All @@ -28,14 +28,14 @@ target_include_directories(spline_psf_cpu_impl PUBLIC include)
target_compile_features(spline_psf_cpu_impl PUBLIC c_std_99)
set_property(TARGET spline_psf_cpu_impl PROPERTY POSITION_INDEPENDENT_CODE ON)

if(CMAKE_CUDA_COMPILER AND NOT CUDA_DISABLED)
if(CUDAToolkit_FOUND AND NOT CUDA_DISABLED)
add_library(spline_psf_cu_impl STATIC src/spline_psf_gpu.cu)
target_include_directories(spline_psf_cu_impl PUBLIC include)
target_compile_features(spline_psf_cu_impl PUBLIC cxx_std_11)
set_target_properties(spline_psf_cu_impl PROPERTIES CUDA_SEPARABLE_COMPILATION ON POSITION_INDEPENDENT_CODE ON)

link_directories(/usr/local/cuda/lib64)
include_directories("${CUDA_INCLUDE_DIRS}")
# link_directories(/usr/local/cuda/lib64)
# include_directories("${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")

pybind11_add_module(spline src/pybind_spline.cpp)
target_link_libraries(spline PRIVATE spline_psf_cu_impl spline_psf_cpu_impl)
Expand Down
16 changes: 8 additions & 8 deletions cpp_cuda_c/src/spline_psf_gpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -522,17 +522,17 @@ auto kernel_roi(spline *sp, float *rois, const int npx, const int npy, const flo
float phot = phot_[r];

/* Compute delta. Will be the same for all following px */
x0 = (int)floor(xc);
x0 = (int)floorf(xc);
x_delta = xc - x0;

y0 = (int)floor(yc);
y0 = (int)floorf(yc);
y_delta = yc - y0;

z0 = (int)floor(zc);
z0 = (int)floorf(zc);
z_delta = zc - z0;

int n_threads = min(1024, npx * npy); // max number of threads per block
int n_blocks = ceil(static_cast<float>(npx * npy) / static_cast<float>(n_threads));
int n_blocks = ceilf(static_cast<float>(npx * npy) / static_cast<float>(n_threads));

fAt3Dj<<<n_blocks, n_threads>>>(sp, rois, r, npx, npy, x0, y0, z0, phot, x_delta, y_delta, z_delta);

Expand All @@ -555,17 +555,17 @@ auto kernel_derivative_roi(spline *sp, float *rois, float *drv_rois, const int n
float bg = bg_[r];

/* Compute delta. Will be the same for all following px */
x0 = (int)floor(xc);
x0 = (int)floorf(xc);
x_delta = xc - x0;

y0 = (int)floor(yc);
y0 = (int)floorf(yc);
y_delta = yc - y0;

z0 = (int)floor(zc);
z0 = (int)floorf(zc);
z_delta = zc - z0;

int n_threads = min(1024, npx * npy); // max number of threads per block
int n_blocks = ceil(static_cast<float>(npx * npy) / static_cast<float>(n_threads));
int n_blocks = ceilf(static_cast<float>(npx * npy) / static_cast<float>(n_threads));

kernel_derivative<<<n_blocks, n_threads>>>(sp, rois, drv_rois, r, npx, npy, x0, y0, z0, phot, bg, x_delta, y_delta, z_delta, add_bg);

Expand Down
4 changes: 2 additions & 2 deletions dist_tools/conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
c_compiler:
- clang # [osx]
- gcc # [linux]
- vs2017 # [win]
- vs2019 # [win]
cxx_compiler:
- clangxx # [osx]
- gxx # [linux]
- vs2017 # [win]
- vs2019 # [win]
target_platform:
- osx-64 # [osx]
- linux-64 # [linux]
Expand Down
2 changes: 1 addition & 1 deletion dist_tools/conda/spline/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requirements:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- python
- cmake =3.15
- cmake =3.17
- ninja
- setuptools

Expand Down
2 changes: 1 addition & 1 deletion python/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- bump2version
- python=3.7
- cmake=3.15
- cmake=3.17
- ninja
- setuptools
- numpy
Expand Down