update: add openmp parallel
This commit is contained in:
20
src/render.c
20
src/render.c
@@ -115,16 +115,22 @@ int render(System *system, double *buffer, int pixel_render_max, double pixel_re
|
||||
|
||||
init(rmax, chi_rela_err, &size, &x, &y);
|
||||
|
||||
gsl_interp_accel *acc = gsl_interp_accel_alloc();
|
||||
gsl_spline *spline = gsl_spline_alloc(gsl_interp_steffen, size);
|
||||
Spline_data spline_data = {spline, acc};
|
||||
gsl_spline_init(spline, x, y, size);
|
||||
|
||||
for(int j = 0; j < H; j++) {
|
||||
for (int i = 0; i < W; i++) {
|
||||
pixel_render(system, i, j, spline_data, buffer+color_index(i,j,0), pixel_render_max, pixel_render_err, r);
|
||||
}
|
||||
}
|
||||
#pragma omp parallel
|
||||
{
|
||||
gsl_interp_accel *acc = gsl_interp_accel_alloc();
|
||||
Spline_data spline_data = {spline, acc};
|
||||
|
||||
#pragma omp for
|
||||
for(int j = 0; j < H; j++) {
|
||||
for (int i = 0; i < W; i++) {
|
||||
pixel_render(system, i, j, spline_data, buffer+color_index(i,j,0), pixel_render_max, pixel_render_err, r);
|
||||
}
|
||||
}
|
||||
|
||||
gsl_interp_accel_free(acc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user