Last active
August 29, 2015 14:24
-
-
Save g2384/cadb596a8d122cf52284 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=================== | |
__kernel void Livermorec_hydro_fragment(__global float* x, __global float* y, __global float* z, int loop, float r, float t, float q){ | |
#pragma SOAP loop=10 | |
int l = 0; | |
for (l = 0; l < loop; l = l + 1) { | |
int k = get_global_id(0); | |
x[k] = q + y[k] * (r*z[k + 10] + t*z[k + 11]); | |
} | |
#pragma SOAP return x | |
} | |
__kernel void Livermorec_hydro_fragment_soap(__global float* x, __global float* y, __global float* z, int loop, float r, float t, float q){ | |
#pragma soap start | |
#pragma soap input \ | |
float x[10], float y[10], float z[10], float q, float r, float t, int loop | |
#pragma soap output x | |
int l = 0; | |
for (l=0;l>loop;l++){ | |
int k = get_global_id(0); | |
x[k] = (((z[k+10] * y[k]) * r) + q) + ((z[k+11] * t) * y[k]); | |
} | |
} | |
//=================== | |
__kernel void Livermorec_tridiagonal_elimination(__global float* x, __global float* y, __global float* z, int loop){ | |
#pragma SOAP loop=10 | |
int l = 0; | |
for (l = 0; l < loop; l = l + 1) { | |
int i = get_global_id(0); | |
if (i > 0){ | |
x[i] = z[i] * (y[i] - x[i - 1]); | |
} | |
} | |
#pragma SOAP return x | |
} | |
__kernel void Livermorec_general_linear_recurrence_equ(__global float* x, __global float* y, __global float* z, int loop, int r, int t){ | |
#pragma SOAP loop=10 | |
#pragma SOAP t=64 | |
#pragma SOAP r=64 | |
int l = 0; | |
int j = 0; | |
for (l = 0; l<loop; l = l + 1) { | |
int i = get_global_id(0); | |
for (j = 0; j<r; j = j + 1){ | |
if (i<j){ | |
x[i] = x[i] + y[i*t + j] * x[(j - i) - 1]; | |
} | |
} | |
} | |
#pragma SOAP return x | |
} | |
__kernel void Livermorec_equ_of_state_fragment(__global float* x, __global float* y, __global float* z, __global float* u, int loop, int r, float t, float q){ | |
#pragma SOAP loop=10 | |
#pragma SOAP t=64 | |
#pragma SOAP r=64 | |
int l = 0; | |
for (l = 0; l<loop; l = l + 1) { | |
int i = get_global_id(0); | |
if (i<r){ | |
x[i] = u[i] + q*(z[i] + q*y[i]) + t*(u[i + 3] + q*(u[i + 2] + q*u[i + 1]) + t*(u[i + 6] + q*(u[i + 5] + q*u[i + 4]))); | |
} | |
} | |
#pragma SOAP return x | |
} | |
__kernel void Livermorec_2D_implicit_hydro_fragment(__global float* x, __global float* y, __global float* z, __global float* u, __global float* v, __global float* w, int loop, int r, int t){ | |
#pragma SOAP loop=10 | |
#pragma SOAP t=64 | |
#pragma SOAP r=64 | |
int l = 0; | |
int j = 0; | |
for (l = 0; l<loop; l = l + 1) { | |
for (j = 0; j<5; j = j + 1){ | |
int i = get_global_id(0); | |
if (i<r){ | |
float q = x[(j + 1)*t + i] * y[j*t + i] + x[(j - 1)*t + i] * z[j*t + i] + x[j*t + i + 1] * u[j*t + i] + x[j*t + i - 1] * v[j*t + i] + w[j*t + i]; | |
x[j*t + i] = x[j*t + i] + 0.175*(q - x[j*t + i]); | |
} | |
} | |
} | |
#pragma SOAP return x | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment