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.
15 lines
293 B
Common Lisp
15 lines
293 B
Common Lisp
/// scale vector with scalar: a = a * alpha
|
|
__kernel void scale(
|
|
__global double *vec,
|
|
const double a,
|
|
const int N)
|
|
{
|
|
unsigned int NUM_THREADS = get_global_size(0);
|
|
int idx = get_global_id(0);
|
|
|
|
while(idx < N){
|
|
vec[idx] *= a;
|
|
idx += NUM_THREADS;
|
|
}
|
|
}
|