mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Kernel files are located in opm/simulators/linalg/bda/opencl/kernels. CMake will combine them for usage in ${PROJECT_BINARY_DIR}/clSources.cpp that becomes part of the library.
18 lines
442 B
Common Lisp
18 lines
442 B
Common Lisp
/// multiply vector with another vector and a scalar, element-wise
|
|
/// add result to a third vector
|
|
__kernel void vmul(
|
|
const double alpha,
|
|
__global double const *in1,
|
|
__global double const *in2,
|
|
__global double *out,
|
|
const int N)
|
|
{
|
|
unsigned int NUM_THREADS = get_global_size(0);
|
|
int idx = get_global_id(0);
|
|
|
|
while(idx < N){
|
|
out[idx] += alpha * in1[idx] * in2[idx];
|
|
idx += NUM_THREADS;
|
|
}
|
|
}
|