forked from kkoziara/stops2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecretion_kernel.c
More file actions
27 lines (25 loc) · 862 Bytes
/
secretion_kernel.c
File metadata and controls
27 lines (25 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#define ROW_SIZE %(row_size)d
#define POP_SIZE %(pop_size)d
#define MAX_LIG %(max_lig)d
/*
Kernel implementing ligands secretion.
*/
__kernel void secretion(__global float* pop, __global float* env, __global int* secr,
__private float MAX_CON, __private float LEAK, __private float SECR_AMOUNT)
{
size_t cell_idx = get_global_id(0);
for (int j = 0; j < MAX_LIG; ++j)
{
int k = secr[j];
float gene_inf = pop[cell_idx * ROW_SIZE + k];
float lig_con = env[cell_idx * MAX_LIG + j];
if (gene_inf > 0)
{
/* secretion of ligand and gene expression drop */
lig_con = min(MAX_CON, lig_con + SECR_AMOUNT);
pop[cell_idx * ROW_SIZE + k] = gene_inf - 1.0f;
}
/* leaking */
env[cell_idx * MAX_LIG + j] = max(0.0f, lig_con - LEAK);
}
}