Skip to content

Commit

Permalink
CI: add more CUDA version to test
Browse files Browse the repository at this point in the history
  • Loading branch information
w3ntao committed Jan 8, 2025
1 parent 47198cd commit 0da0c6c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cuda-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
strategy:
fail-fast: false
matrix:
cuda: [ '12.5.0' ]
cuda: [ '11.0.1', '11.5.0', '12.0.0', '12.5.0' ]

name: GPU build (CUDA ${{ matrix.cuda }})

runs-on: ubuntu-latest
steps:
- uses: jimver/[email protected].17
- uses: jimver/[email protected].19
id: cuda-toolkit
with:
cuda: ${{ matrix.cuda }}
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ include_directories("${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")
message(STATUS "nvcc path: ${CMAKE_CUDA_COMPILER}")
message(STATUS "nvcc version = ${CMAKE_CUDA_COMPILER_VERSION}")

if (${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS "12.3.0")
message(FATAL_ERROR "you need NVCC >= 12.3.0 to build this project (required by cuda::std::optional)")
if (${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS "11.0.1")
message(FATAL_ERROR "NVCC < 11.0.1 was not test")
endif ()

add_subdirectory("src/ext")
Expand Down
56 changes: 28 additions & 28 deletions src/pbrt/integrators/bdpt.cu
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,46 @@ struct FilmSample {
Point2f p_film;
SampledSpectrum l_path;
SampledWavelengths lambda;
};

struct FSComparator {
bool operator()(FilmSample const &left, FilmSample const &right) const {
if (left.p_film.x < right.p_film.x) {
return true;
}

if (left.p_film.x > right.p_film.x) {
return false;
}

if (left.p_film.y < right.p_film.y) {
return true;
}

if (left.p_film.y > right.p_film.y) {
return false;
}

for (int idx = 0; idx < NSpectrumSamples; ++idx) {
if (left.l_path[idx] < right.l_path[idx]) {
struct Comparator {
bool operator()(FilmSample const &left, FilmSample const &right) const {
if (left.p_film.x < right.p_film.x) {
return true;
}

if (left.l_path[idx] > right.l_path[idx]) {
if (left.p_film.x > right.p_film.x) {
return false;
}

if (left.lambda[idx] < right.lambda[idx]) {
if (left.p_film.y < right.p_film.y) {
return true;
}

if (left.lambda[idx] > right.lambda[idx]) {
if (left.p_film.y > right.p_film.y) {
return false;
}
}

return false;
}
for (int idx = 0; idx < NSpectrumSamples; ++idx) {
if (left.l_path[idx] < right.l_path[idx]) {
return true;
}

if (left.l_path[idx] > right.l_path[idx]) {
return false;
}

if (left.lambda[idx] < right.lambda[idx]) {
return true;
}

if (left.lambda[idx] > right.lambda[idx]) {
return false;
}
}

return false;
}
};
};

static __global__ void gpu_init_stratified_samplers(Sampler *samplers,
Expand Down Expand Up @@ -1073,7 +1073,7 @@ void BDPTIntegrator::render(Film *film, uint samples_per_pixel, const bool previ
// sort to make film writing deterministic
// std::sort(film_samples + 0, film_samples + (*film_sample_counter), FSComparator());
std::sort(film_samples + 0, film_samples + (*film_sample_counter) - 1,
FSComparator());
FilmSample::Comparator());
}

for (uint idx = 0; idx < *film_sample_counter; ++idx) {
Expand Down
25 changes: 13 additions & 12 deletions src/pbrt/integrators/wavefront_path.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ struct FrameBuffer {
SampledSpectrum radiance;
SampledWavelengths lambda;
FloatType weight;
};

struct FBComparator {
bool operator()(FrameBuffer const &left, FrameBuffer const &right) const {
if (left.pixel_idx < right.pixel_idx) {
return true;
}
struct Comparator {
bool operator()(FrameBuffer const &left, FrameBuffer const &right) const {
if (left.pixel_idx < right.pixel_idx) {
return true;
}

if (left.pixel_idx > right.pixel_idx) {
return false;
}
if (left.pixel_idx > right.pixel_idx) {
return false;
}

return left.sample_idx < right.sample_idx;
}
return left.sample_idx < right.sample_idx;
}
};
};

struct MISParameter {
Expand Down Expand Up @@ -705,7 +705,8 @@ void WavefrontPathIntegrator::render(Film *film, const bool preview) {
if (queues.frame_buffer_counter > 0) {
// sort to make film writing deterministic
std::sort(queues.frame_buffer_queue + 0,
queues.frame_buffer_queue + queues.frame_buffer_counter, FBComparator());
queues.frame_buffer_queue + queues.frame_buffer_counter,
FrameBuffer::Comparator());

write_frame_buffer<<<divide_and_ceil(queues.frame_buffer_counter, threads), threads>>>(
film, &queues);
Expand Down

0 comments on commit 0da0c6c

Please sign in to comment.