Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
qinatan committed Aug 26, 2023
1 parent bcc9b85 commit 1f5489d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
3 changes: 1 addition & 2 deletions include/micm/process/cuda_process_set.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ namespace micm

std::chrono::nanoseconds AddJacobianTermsKernelDriver(
micm::CUDAMatrixParam& matrixParam,
CUDAProcessSetParam& processSetParam,
// const size_t* number_of_reactants,
const size_t* number_of_reactants,
const size_t* reactant_ids,
size_t reactant_ids_size,
const size_t* number_of_products,
Expand Down
8 changes: 1 addition & 7 deletions include/micm/process/cuda_process_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#endif

#ifdef USE_CUDA
struct CUDAProcessSetParam{
const size_t* number_of_reactants;
};
namespace micm
{
/// @brief A GPU-based implementation of ProcessSet
Expand Down Expand Up @@ -87,12 +84,9 @@ namespace micm
matrixParam.n_reactions_ = rate_constants[0].size();
matrixParam.n_species_ = state_variables[0].size();
matrixParam.jacobian_size_ = jacobian.AsVector().size();
CUDAProcessSetParam processSetParam;
processSetParam.number_of_reactants = number_of_reactants_.data();
std::chrono::nanoseconds kernel_duration = micm::cuda::AddJacobianTermsKernelDriver(
matrixParam,
processSetParam,
//number_of_reactants_.data(),
number_of_reactants_.data(),
reactant_ids_.data(),
reactant_ids_.size(),
number_of_products_.data(),
Expand Down
8 changes: 3 additions & 5 deletions src/process/process_set.cu
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ namespace micm

std::chrono::nanoseconds AddJacobianTermsKernelDriver(
micm::CUDAMatrixParam& matrixParam,
CUDAProcessSetParam& processSetParam,
//const size_t* number_of_reactants,
const size_t* number_of_reactants,
const size_t* reactant_ids,
size_t reactant_ids_size,
const size_t* number_of_products,
Expand Down Expand Up @@ -148,7 +147,7 @@ namespace micm
cudaMemcpy(d_rate_constants, matrixParam.rate_constants_, sizeof(double) * matrixParam.n_grids_ * matrixParam.n_reactions_, cudaMemcpyHostToDevice);
cudaMemcpy(d_state_variables, matrixParam.state_variables_, sizeof(double) * matrixParam.n_grids_ * matrixParam.n_species_, cudaMemcpyHostToDevice);
cudaMemcpy(d_jacobian, matrixParam.jacobian_, sizeof(double) * matrixParam.jacobian_size_, cudaMemcpyHostToDevice);
cudaMemcpy(d_number_of_reactants, processSetParam.number_of_reactants, sizeof(size_t) * matrixParam.n_reactions_, cudaMemcpyHostToDevice);
cudaMemcpy(d_number_of_reactants, number_of_reactants, sizeof(size_t) * matrixParam.n_reactions_, cudaMemcpyHostToDevice);
cudaMemcpy(d_reactant_ids, reactant_ids, sizeof(size_t) * reactant_ids_size, cudaMemcpyHostToDevice);
cudaMemcpy(d_number_of_products, number_of_products, sizeof(size_t) * matrixParam.n_reactions_, cudaMemcpyHostToDevice);
cudaMemcpy(d_yields, yields, sizeof(double) * yields_size, cudaMemcpyHostToDevice);
Expand All @@ -175,8 +174,7 @@ namespace micm
AddJacobianTermsKernel<<<total_blocks, threads_per_block>>>(
device,
n_grids,
n_reactions
);
n_reactions);
cudaDeviceSynchronize();
auto endTime = std::chrono::high_resolution_clock::now();
auto kernel_duration = std::chrono::duration_cast<std::chrono::nanoseconds>(endTime - startTime);
Expand Down

0 comments on commit 1f5489d

Please sign in to comment.