Skip to content

Commit 9263f55

Browse files
author
dyzheng
committed
Fix: cuda and rocm compiling error
1 parent c5322c8 commit 9263f55

2 files changed

Lines changed: 0 additions & 126 deletions

File tree

source/module_hsolver/kernels/cuda/math_kernel_op.cu

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -338,55 +338,6 @@ __global__ void vector_mul_vector_kernel(
338338
}
339339
}
340340

341-
// vector operator: result[i] = vector[i] / constant
342-
template <>
343-
void vector_div_constant_op<double, base_device::DEVICE_GPU>::operator()(const int& dim,
344-
double* result,
345-
const double* vector,
346-
const double constant)
347-
{
348-
// In small cases, 1024 threads per block will only utilize 17 blocks, much less than 40
349-
int thread = thread_per_block;
350-
int block = (dim + thread - 1) / thread;
351-
vector_div_constant_kernel<double><<<block, thread>>>(dim, result, vector, constant);
352-
353-
cudaCheckOnDebug();
354-
}
355-
356-
template <typename FPTYPE>
357-
inline void vector_div_constant_wrapper(const int& dim,
358-
std::complex<FPTYPE>* result,
359-
const std::complex<FPTYPE>* vector,
360-
const FPTYPE constant)
361-
{
362-
thrust::complex<FPTYPE>* result_tmp = reinterpret_cast<thrust::complex<FPTYPE>*>(result);
363-
const thrust::complex<FPTYPE>* vector_tmp = reinterpret_cast<const thrust::complex<FPTYPE>*>(vector);
364-
365-
int thread = thread_per_block;
366-
int block = (dim + thread - 1) / thread;
367-
vector_div_constant_kernel<thrust::complex<FPTYPE>><<<block, thread>>>(dim, result_tmp, vector_tmp, constant);
368-
369-
cudaCheckOnDebug();
370-
}
371-
372-
template <>
373-
void vector_div_constant_op<std::complex<float>, base_device::DEVICE_GPU>::operator()(const int& dim,
374-
std::complex<float>* result,
375-
const std::complex<float>* vector,
376-
const float constant)
377-
{
378-
vector_div_constant_wrapper(dim, result, vector, constant);
379-
}
380-
381-
template <>
382-
void vector_div_constant_op<std::complex<double>, base_device::DEVICE_GPU>::operator()(const int& dim,
383-
std::complex<double>* result,
384-
const std::complex<double>* vector,
385-
const double constant)
386-
{
387-
vector_div_constant_wrapper(dim, result, vector, constant);
388-
}
389-
390341
template <typename T>
391342
__global__ void vector_div_vector_kernel(
392343
const int size,

source/module_hsolver/kernels/rocm/math_kernel_op.hip.cu

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -257,83 +257,6 @@ __global__ void vector_mul_vector_kernel(
257257
}
258258
}
259259

260-
template <typename T>
261-
__launch_bounds__(1024)
262-
__global__ void vector_div_constant_kernel(const int size,
263-
T* result,
264-
const T* vector,
265-
const typename GetTypeReal<T>::type constant)
266-
{
267-
int i = blockIdx.x * blockDim.x + threadIdx.x;
268-
if (i < size)
269-
{
270-
result[i] = vector[i] / constant;
271-
}
272-
}
273-
274-
// vector operator: result[i] = vector[i] / constant
275-
template <>
276-
void vector_div_constant_op<double, base_device::DEVICE_GPU>::operator()(const int& dim,
277-
double* result,
278-
const double* vector,
279-
const double constant)
280-
{
281-
int thread = 1024;
282-
int block = (dim + thread - 1) / thread;
283-
hipLaunchKernelGGL(HIP_KERNEL_NAME(vector_div_constant_kernel<double>),
284-
dim3(block),
285-
dim3(thread),
286-
0,
287-
0,
288-
dim,
289-
result,
290-
vector,
291-
constant);
292-
293-
hipCheckOnDebug();
294-
}
295-
296-
template <typename FPTYPE>
297-
inline void vector_div_constant_wrapper(const int& dim,
298-
std::complex<FPTYPE>* result,
299-
const std::complex<FPTYPE>* vector,
300-
const FPTYPE constant)
301-
{
302-
thrust::complex<FPTYPE>* result_tmp = reinterpret_cast<thrust::complex<FPTYPE>*>(result);
303-
const thrust::complex<FPTYPE>* vector_tmp = reinterpret_cast<const thrust::complex<FPTYPE>*>(vector);
304-
int thread = 1024;
305-
int block = (dim + thread - 1) / thread;
306-
hipLaunchKernelGGL(HIP_KERNEL_NAME(vector_div_constant_kernel<thrust::complex<FPTYPE>>),
307-
dim3(block),
308-
dim3(thread),
309-
0,
310-
0,
311-
dim,
312-
result_tmp,
313-
vector_tmp,
314-
constant);
315-
316-
hipCheckOnDebug();
317-
}
318-
319-
template <>
320-
void vector_div_constant_op<std::complex<float>, base_device::DEVICE_GPU>::operator()(const int& dim,
321-
std::complex<float>* result,
322-
const std::complex<float>* vector,
323-
const float constant)
324-
{
325-
vector_div_constant_wrapper(dim, result, vector, constant);
326-
}
327-
328-
template <>
329-
void vector_div_constant_op<std::complex<double>, base_device::DEVICE_GPU>::operator()(const int& dim,
330-
std::complex<double>* result,
331-
const std::complex<double>* vector,
332-
const double constant)
333-
{
334-
vector_div_constant_wrapper(dim, result, vector, constant);
335-
}
336-
337260
template <typename T>
338261
__launch_bounds__(1024)
339262
__global__ void vector_div_vector_kernel(

0 commit comments

Comments
 (0)