Skip to content

Commit

Permalink
pass LLNL ci
Browse files Browse the repository at this point in the history
  • Loading branch information
nychiang committed May 4, 2023
1 parent 641fa10 commit a8d4183
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/LinAlg/VectorCudaKernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,9 @@ __global__ void relax_bounds_cu(int n,

/** @brief set d_ptr[i] = 1 if d1[i] == d2[i], otherwirse 0 */
__global__ void set_if_match_cu(int n,
double* d_ptr,
double* d1,
double* d2)
int* d_ptr,
const double* d1,
const double* d2)
{
const int num_threads = blockDim.x * gridDim.x;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
Expand Down Expand Up @@ -1358,7 +1358,7 @@ void copyToStartingAt_w_pattern_kernel(int n_src,
dd);
}

int num_match_local_kernel(int n, double* d1, const double* d2)
int num_match_local_kernel(int n, const double* d1, const double* d2)
{
int num_blocks = (n+block_size-1)/block_size;

Expand Down
2 changes: 1 addition & 1 deletion src/LinAlg/VectorCudaKernels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void copyToStartingAt_w_pattern_kernel(int n_src,
const double* dd);

/// @brief return the numbers of identical elements between two vectors
int num_match_local_kernel(int n, double* d1, const double* d2);
int num_match_local_kernel(int n, const double* d1, const double* d2);

/** @brief process variable bounds */
void process_bounds_local_kernel(int n_local,
Expand Down
10 changes: 5 additions & 5 deletions src/LinAlg/VectorHipKernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,9 @@ __global__ void relax_bounds_hip(int n,

/** @brief set d_ptr[i] = 1 if d1[i] == d2[i], otherwirse 0 */
__global__ void set_if_match_hip(int n,
double* d_ptr,
double* d1,
double* d2)
int* d_ptr,
const double* d1,
const double* d2)
{
const int num_threads = blockDim.x * gridDim.x;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
Expand Down Expand Up @@ -1353,7 +1353,7 @@ void copyToStartingAt_w_pattern_kernel(int n_src,
dd);
}

int num_match_local_kernel(int n, double* d1, const double* d2)
int num_match_local_kernel(int n, const double* d1, const double* d2)
{
int num_blocks = (n+block_size-1)/block_size;

Expand All @@ -1362,7 +1362,7 @@ int num_match_local_kernel(int n, double* d1, const double* d2)
int* d_ptr = thrust::raw_pointer_cast(dv_ptr);

// set d_ptr[i] = 1 if d1[i] == d2[i], otherwirse 0
set_if_match_cu<<<num_blocks,block_size>>>(n, d_ptr, d1, d2);
set_if_match_hip<<<num_blocks,block_size>>>(n, d_ptr, d1, d2);

int rval = thrust::reduce(thrust::device, d_ptr, d_ptr+n, 0, thrust::plus<int>());

Expand Down
2 changes: 1 addition & 1 deletion src/LinAlg/VectorHipKernels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void copyToStartingAt_w_pattern_kernel(int n_src,
const double* dd);

/// @brief return the numbers of identical elements between two vectors
int num_match_local_kernel(int n, double* d1, const double* d2);
int num_match_local_kernel(int n, const double* d1, const double* d2);

/** @brief process variable bounds */
void process_bounds_local_kernel(int n_local,
Expand Down
6 changes: 4 additions & 2 deletions src/LinAlg/hiopVectorCuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,8 +1089,8 @@ bool hiopVectorCuda::is_equal(const hiopVector& vec) const

size_type hiopVectorCuda::num_match(const hiopVector& vec) const
{
double* dd = data_;
double* vd = vec.local_data();
const double* dd = data_;
const double* vd = vec.local_data_const();
int sum_match = sum_match = hiop::cuda::num_match_local_kernel(n_local_, dd, vd);

#ifdef HIOP_USE_MPI
Expand Down Expand Up @@ -1130,6 +1130,8 @@ bool hiopVectorCuda::process_bounds_local(const hiopVector& xu,
n_bnds_lu,
n_fixed_vars,
fixed_var_tol);

return true;
}

void hiopVectorCuda::relax_bounds_vec(hiopVector& xu,
Expand Down
6 changes: 4 additions & 2 deletions src/LinAlg/hiopVectorHip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,8 @@ bool hiopVectorHip::is_equal(const hiopVector& vec) const

size_type hiopVectorHip::num_match(const hiopVector& vec) const
{
double* dd = data_;
double* vd = vec.local_data();
const double* dd = data_;
const double* vd = vec.local_data_const();
int sum_match = sum_match = hiop::cuda::num_match_local_kernel(n_local_, dd, vd);

#ifdef HIOP_USE_MPI
Expand Down Expand Up @@ -1134,6 +1134,8 @@ bool hiopVectorHip::process_bounds_local(const hiopVector& xu,
n_bnds_lu,
n_fixed_vars,
fixed_var_tol);

return true;
}

void hiopVectorHip::relax_bounds_vec(hiopVector& xu,
Expand Down
2 changes: 1 addition & 1 deletion src/LinAlg/hiopVectorRajaImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,7 @@ size_type hiopVectorRaja<MEM, POL>::num_match(const hiopVector& vec) const
sum += 1;
}
});
int all_equal = (sum.get() == 0);
int all_equal = sum.get();

#ifdef HIOP_USE_MPI
int all_equalG;
Expand Down
1 change: 0 additions & 1 deletion tests/LinAlg/vectorTests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,6 @@ class VectorTests : public TestBase
{
const local_ordinal_type Nx = x.get_size();
int fail = 0;
int n_match = 0;
x.setToConstant(one);
y.setToConstant(one);

Expand Down

0 comments on commit a8d4183

Please sign in to comment.