caute, robil ste uz niekto v ispc? Nejak som ho uz rozbehal (pod linuxom) ale pri spustani samotnych prikladov mam problem.
skusil som jednoduchy priklad mandelbrot:
https://ispc.github.io/example.html
mandelbrot.cpp
Kód: Vybrať všetko
int main() {
unsigned int width = 768, height = 512;
float x0 = -2., x1 = 1.;
float y0 = -1., y1 = 1.;
int maxIterations = 256;
int *buf = new int[width*height];
mandelbrot_ispc(x0, y0, x1, y1, width, height, maxIterations, buf);
// write output...
}
Kód: Vybrať všetko
static inline int mandel(float c_re, float c_im, int count) {
float z_re = c_re, z_im = c_im;
int i;
for (i = 0; i < count; ++i) {
if (z_re * z_re + z_im * z_im > 4.)
break;
float new_re = z_re*z_re - z_im*z_im;
float new_im = 2.f * z_re * z_im;
z_re = c_re + new_re;
z_im = c_im + new_im;
}
return i;
}
export void mandelbrot_ispc(uniform float x0, uniform float y0,
uniform float x1, uniform float y1,
uniform int width, uniform int height,
uniform int maxIterations,
uniform int output[]) {
float dx = (x1 - x0) / width;
float dy = (y1 - y0) / height;
for (uniform int j = 0; j < height; j++) {
foreach (i = 0 ... width) {
float x = x0 + i * dx;
float y = y0 + j * dy;
int index = j * width + i;
output[index] = mandel(x, y, maxIterations);
}
}
}
Kód: Vybrať všetko
ispc -O2 --target=avx mandelbrot.ispc -o objs/mandelbrot_ispc.o -h objs/mandelbrot_ispc.h
Kód: Vybrať všetko
g++ mandelbrot.cpp -Iobjs/ -O3 -Wall -c -o objs/mandelbrot.o
Co nechapem.mandelbrot.cpp: In function ‘int main()’:
mandelbrot.cpp:8:70: error: ‘mandelbrot_ispc’ was not declared in this scope
mandelbrot_ispc(x0, y0, x1, y1, width, height, maxIterations, buf);
.....................................................................................................^
Skusil som mandelbrot stiahnut z githubu:
https://github.com/ispc/ispc/tree/maste ... mandelbrot
a pri tom druhom prikaze mi vyhadzuje:
mandelbrot.cpp: In function ‘int main(int, char**)’:
mandelbrot.cpp:102:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < test_iterations[0]; ++i) {
^
mandelbrot.cpp:103:31: error: ‘reset_and_start_timer’ was not declared in this scope
reset_and_start_timer();
^
mandelbrot.cpp:105:41: error: ‘get_elapsed_mcycles’ was not declared in this scope
double dt = get_elapsed_mcycles();
^
mandelbrot.cpp:122:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < test_iterations[1]; ++i) {
^
mandelbrot.cpp:123:31: error: ‘reset_and_start_timer’ was not declared in this scope
reset_and_start_timer();
^
mandelbrot.cpp:125:41: error: ‘get_elapsed_mcycles’ was not declared in this scope
double dt = get_elapsed_mcycles();
^