@@ -393,9 +393,9 @@ __global__ void add_linear_damping_term_cu(int n, double* data, const double* ix
393393}
394394
395395/* * @brief y[i] = 1.0 if x[i] is positive and id[i] = 1.0, otherwise y[i] = 0 */
396- __global__ void is_posive_w_pattern_cu (int n, double * data, const double * vd, const double * id)
396+ __global__ void is_posive_w_pattern_cu (int n, int * data, const double * vd, const double * id)
397397{
398- extern __shared__ float shared_sum[];
398+ extern __shared__ int shared_sum[];
399399 const int num_threads = blockDim .x * gridDim .x ;
400400 const int tid = blockIdx .x * blockDim .x + threadIdx .x ;
401401 int sum = 0 ;
@@ -957,7 +957,7 @@ int is_posive_w_pattern_kernel(int n_local,
957957 cudaMemcpy (h_retval, d_retval, num_blocks*sizeof (int ), cudaMemcpyDeviceToHost);
958958
959959 int sum_result = 0 ;
960- for (int i=0 ;i<block_size ;i++) {
960+ for (int i=0 ;i<num_blocks ;i++) {
961961 sum_result += h_retval[i];
962962 }
963963
@@ -1242,9 +1242,10 @@ int all_positive_w_pattern_kernel(int n, const double* d1, const double* id)
12421242 // TODO: how to avoid this temp vec?
12431243// thrust::device_vector<double> v_temp(n);
12441244// double* dv_ptr = thrust::raw_pointer_cast(v_temp.data());
1245+ // is_posive_w_pattern_kernel(n, dv_ptr, d1, id);
12451246// return thrust::reduce(thrust::device, v_temp.begin(), v_temp.end(), (int)0, thrust::plus<int>());
12461247
1247- int irev = hiop::cuda::is_posive_w_pattern_kernel (n, dv_ptr, d1, id);
1248+ int irev = hiop::cuda::is_posive_w_pattern_kernel (n, d1, id);
12481249 return irev;
12491250}
12501251
0 commit comments