spla
src
opencl
generated
auto_vector_formats.hpp
Go to the documentation of this file.
1
// Copyright (c) 2021 - 2023 SparseLinearAlgebra
3
// Autogenerated file, do not modify
5
6
#pragma once
7
8
static
const
char
source_vector_formats[] = R
"(
9
10
11
__kernel void sparse_to_dense(__global const uint* Ai,
12
__global const TYPE* Ax,
13
__global TYPE* Rx,
14
const uint n) {
15
const uint gid = get_global_id(0);
16
const uint gstrige = get_global_size(0);
17
18
for (uint i = gid; i < n; i += gstrige) {
19
Rx[Ai[i]] = Ax[i];
20
}
21
}
22
23
__kernel void dense_to_sparse(__global const TYPE* Ax,
24
__global uint* Ri,
25
__global TYPE* Rx,
26
__global uint* count,
27
const uint n,
28
const TYPE fill_value) {
29
const uint gid = get_global_id(0);
30
const uint gstrige = get_global_size(0);
31
32
for (uint i = gid; i < n; i += gstrige) {
33
if (Ax[i] != fill_value) {
34
const uint offset = atomic_inc(count);
35
Ri[offset] = i;
36
Rx[offset] = Ax[i];
37
}
38
}
39
}
40
)";
Generated by
1.9.1