本文整理汇总了C++中ops_compute_transfer函数的典型用法代码示例。如果您正苦于以下问题:C++ ops_compute_transfer函数的具体用法?C++ ops_compute_transfer怎么用?C++ ops_compute_transfer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ops_compute_transfer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ops_par_loop_reset_field_kernel1
//.........这里部分代码省略.........
#ifdef OPS_GPU
double *p_a0 = (double *)((char *)args[0].data_d + base0);
#else
double *p_a0 = (double *)((char *)args[0].data + base0);
#endif
#ifdef OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[1].dat->d_m[d] + OPS_sub_dat_list[args[1].dat->index]->d_im[d];
#else //OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[1].dat->d_m[d];
#endif //OPS_MPI
int base1 = dat1 * 1 *
(start[0] * args[1].stencil->stride[0] - args[1].dat->base[0] - d_m[0]);
base1 = base1+ dat1 *
args[1].dat->size[0] *
(start[1] * args[1].stencil->stride[1] - args[1].dat->base[1] - d_m[1]);
base1 = base1+ dat1 *
args[1].dat->size[0] *
args[1].dat->size[1] *
(start[2] * args[1].stencil->stride[2] - args[1].dat->base[2] - d_m[2]);
#ifdef OPS_GPU
double *p_a1 = (double *)((char *)args[1].data_d + base1);
#else
double *p_a1 = (double *)((char *)args[1].data + base1);
#endif
#ifdef OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[2].dat->d_m[d] + OPS_sub_dat_list[args[2].dat->index]->d_im[d];
#else //OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[2].dat->d_m[d];
#endif //OPS_MPI
int base2 = dat2 * 1 *
(start[0] * args[2].stencil->stride[0] - args[2].dat->base[0] - d_m[0]);
base2 = base2+ dat2 *
args[2].dat->size[0] *
(start[1] * args[2].stencil->stride[1] - args[2].dat->base[1] - d_m[1]);
base2 = base2+ dat2 *
args[2].dat->size[0] *
args[2].dat->size[1] *
(start[2] * args[2].stencil->stride[2] - args[2].dat->base[2] - d_m[2]);
#ifdef OPS_GPU
double *p_a2 = (double *)((char *)args[2].data_d + base2);
#else
double *p_a2 = (double *)((char *)args[2].data + base2);
#endif
#ifdef OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[3].dat->d_m[d] + OPS_sub_dat_list[args[3].dat->index]->d_im[d];
#else //OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[3].dat->d_m[d];
#endif //OPS_MPI
int base3 = dat3 * 1 *
(start[0] * args[3].stencil->stride[0] - args[3].dat->base[0] - d_m[0]);
base3 = base3+ dat3 *
args[3].dat->size[0] *
(start[1] * args[3].stencil->stride[1] - args[3].dat->base[1] - d_m[1]);
base3 = base3+ dat3 *
args[3].dat->size[0] *
args[3].dat->size[1] *
(start[2] * args[3].stencil->stride[2] - args[3].dat->base[2] - d_m[2]);
#ifdef OPS_GPU
double *p_a3 = (double *)((char *)args[3].data_d + base3);
#else
double *p_a3 = (double *)((char *)args[3].data + base3);
#endif
#ifdef OPS_GPU
ops_H_D_exchanges_device(args, 4);
#else
ops_H_D_exchanges_host(args, 4);
#endif
ops_halo_exchanges(args,4,range);
ops_timers_core(&c1,&t1);
OPS_kernels[3].mpi_time += t1-t2;
reset_field_kernel1_c_wrapper(
p_a0,
p_a1,
p_a2,
p_a3,
x_size, y_size, z_size);
ops_timers_core(&c2,&t2);
OPS_kernels[3].time += t2-t1;
#ifdef OPS_GPU
ops_set_dirtybit_device(args, 4);
#else
ops_set_dirtybit_host(args, 4);
#endif
ops_set_halo_dirtybit3(&args[0],range);
ops_set_halo_dirtybit3(&args[2],range);
//Update kernel record
OPS_kernels[3].transfer += ops_compute_transfer(dim, range, &arg0);
OPS_kernels[3].transfer += ops_compute_transfer(dim, range, &arg1);
OPS_kernels[3].transfer += ops_compute_transfer(dim, range, &arg2);
OPS_kernels[3].transfer += ops_compute_transfer(dim, range, &arg3);
}
示例2: ops_par_loop_initialise_chunk_kernel_volume
//.........这里部分代码省略.........
#else
double *p_a2 = (double *)((char *)args[2].data + base2);
#endif
int base3 = args[3].dat->base_offset +
(OPS_soa ? args[3].dat->type_size : args[3].dat->elem_size) *
start[0] * args[3].stencil->stride[0];
base3 = base3 +
(OPS_soa ? args[3].dat->type_size : args[3].dat->elem_size) *
args[3].dat->size[0] * start[1] * args[3].stencil->stride[1];
#ifdef OPS_GPU
double *p_a3 = (double *)((char *)args[3].data_d + base3);
#else
double *p_a3 = (double *)((char *)args[3].data + base3);
#endif
int base4 = args[4].dat->base_offset +
(OPS_soa ? args[4].dat->type_size : args[4].dat->elem_size) *
start[0] * args[4].stencil->stride[0];
base4 = base4 +
(OPS_soa ? args[4].dat->type_size : args[4].dat->elem_size) *
args[4].dat->size[0] * start[1] * args[4].stencil->stride[1];
#ifdef OPS_GPU
double *p_a4 = (double *)((char *)args[4].data_d + base4);
#else
double *p_a4 = (double *)((char *)args[4].data + base4);
#endif
int x_size = MAX(0, end[0] - start[0]);
int y_size = MAX(0, end[1] - start[1]);
// initialize global variable with the dimension of dats
xdim0 = args[0].dat->size[0];
xdim1 = args[1].dat->size[0];
xdim2 = args[2].dat->size[0];
xdim3 = args[3].dat->size[0];
xdim4 = args[4].dat->size[0];
if (xdim0 != xdim0_initialise_chunk_kernel_volume_h ||
xdim1 != xdim1_initialise_chunk_kernel_volume_h ||
xdim2 != xdim2_initialise_chunk_kernel_volume_h ||
xdim3 != xdim3_initialise_chunk_kernel_volume_h ||
xdim4 != xdim4_initialise_chunk_kernel_volume_h) {
xdim0_initialise_chunk_kernel_volume = xdim0;
xdim0_initialise_chunk_kernel_volume_h = xdim0;
xdim1_initialise_chunk_kernel_volume = xdim1;
xdim1_initialise_chunk_kernel_volume_h = xdim1;
xdim2_initialise_chunk_kernel_volume = xdim2;
xdim2_initialise_chunk_kernel_volume_h = xdim2;
xdim3_initialise_chunk_kernel_volume = xdim3;
xdim3_initialise_chunk_kernel_volume_h = xdim3;
xdim4_initialise_chunk_kernel_volume = xdim4;
xdim4_initialise_chunk_kernel_volume_h = xdim4;
}
// Halo Exchanges
#ifdef OPS_GPU
ops_H_D_exchanges_device(args, 5);
#else
ops_H_D_exchanges_host(args, 5);
#endif
ops_halo_exchanges(args, 5, range);
#ifdef OPS_GPU
ops_H_D_exchanges_device(args, 5);
#else
ops_H_D_exchanges_host(args, 5);
#endif
if (OPS_diags > 1) {
ops_timers_core(&c2, &t2);
OPS_kernels[14].mpi_time += t2 - t1;
}
initialise_chunk_kernel_volume_c_wrapper(p_a0, p_a1, p_a2, p_a3, p_a4, x_size,
y_size);
if (OPS_diags > 1) {
ops_timers_core(&c1, &t1);
OPS_kernels[14].time += t1 - t2;
}
#ifdef OPS_GPU
ops_set_dirtybit_device(args, 5);
#else
ops_set_dirtybit_host(args, 5);
#endif
ops_set_halo_dirtybit3(&args[0], range);
ops_set_halo_dirtybit3(&args[2], range);
ops_set_halo_dirtybit3(&args[4], range);
if (OPS_diags > 1) {
// Update kernel record
ops_timers_core(&c2, &t2);
OPS_kernels[14].mpi_time += t2 - t1;
OPS_kernels[14].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[14].transfer += ops_compute_transfer(dim, start, end, &arg1);
OPS_kernels[14].transfer += ops_compute_transfer(dim, start, end, &arg2);
OPS_kernels[14].transfer += ops_compute_transfer(dim, start, end, &arg3);
OPS_kernels[14].transfer += ops_compute_transfer(dim, start, end, &arg4);
}
}
示例3: ops_par_loop_update_halo_kernel4_plus_2_b
//.........这里部分代码省略.........
int start2 = start_i;
// set up initial pointers
int d_m[OPS_MAX_DIM];
#ifdef OPS_MPI
for (int d = 0; d < dim; d++)
d_m[d] =
args[0].dat->d_m[d] + OPS_sub_dat_list[args[0].dat->index]->d_im[d];
#else
for (int d = 0; d < dim; d++)
d_m[d] = args[0].dat->d_m[d];
#endif
int base0 = dat0 * 1 * (start0 * args[0].stencil->stride[0] -
args[0].dat->base[0] - d_m[0]);
base0 = base0 +
dat0 * args[0].dat->size[0] * (start1 * args[0].stencil->stride[1] -
args[0].dat->base[1] - d_m[1]);
base0 = base0 +
dat0 * args[0].dat->size[0] * args[0].dat->size[1] *
(start2 * args[0].stencil->stride[2] - args[0].dat->base[2] -
d_m[2]);
p_a[0] = (char *)args[0].data + base0;
#ifdef OPS_MPI
for (int d = 0; d < dim; d++)
d_m[d] =
args[1].dat->d_m[d] + OPS_sub_dat_list[args[1].dat->index]->d_im[d];
#else
for (int d = 0; d < dim; d++)
d_m[d] = args[1].dat->d_m[d];
#endif
int base1 = dat1 * 1 * (start0 * args[1].stencil->stride[0] -
args[1].dat->base[0] - d_m[0]);
base1 = base1 +
dat1 * args[1].dat->size[0] * (start1 * args[1].stencil->stride[1] -
args[1].dat->base[1] - d_m[1]);
base1 = base1 +
dat1 * args[1].dat->size[0] * args[1].dat->size[1] *
(start2 * args[1].stencil->stride[2] - args[1].dat->base[2] -
d_m[2]);
p_a[1] = (char *)args[1].data + base1;
p_a[2] = (char *)args[2].data;
for (int n_z = start_i; n_z < finish_i; n_z++) {
for (int n_y = start[1]; n_y < end[1]; n_y++) {
for (int n_x = start[0];
n_x < start[0] + (end[0] - start[0]) / SIMD_VEC; n_x++) {
// call kernel function, passing in pointers to data -vectorised
#pragma simd
for (int i = 0; i < SIMD_VEC; i++) {
update_halo_kernel4_plus_2_b((double *)p_a[0] + i * 1 * 1,
(double *)p_a[1] + i * 1 * 1,
(int *)p_a[2]);
}
// shift pointers to data x direction
p_a[0] = p_a[0] + (dat0 * off0_0) * SIMD_VEC;
p_a[1] = p_a[1] + (dat1 * off1_0) * SIMD_VEC;
}
for (int n_x = start[0] + ((end[0] - start[0]) / SIMD_VEC) * SIMD_VEC;
n_x < end[0]; n_x++) {
// call kernel function, passing in pointers to data - remainder
update_halo_kernel4_plus_2_b((double *)p_a[0], (double *)p_a[1],
(int *)p_a[2]);
// shift pointers to data x direction
p_a[0] = p_a[0] + (dat0 * off0_0);
p_a[1] = p_a[1] + (dat1 * off1_0);
}
// shift pointers to data y direction
p_a[0] = p_a[0] + (dat0 * off0_1);
p_a[1] = p_a[1] + (dat1 * off1_1);
}
// shift pointers to data z direction
p_a[0] = p_a[0] + (dat0 * off0_2);
p_a[1] = p_a[1] + (dat1 * off1_2);
}
}
if (OPS_diags > 1) {
ops_timers_core(&c1, &t1);
OPS_kernels[79].time += t1 - t2;
}
ops_set_dirtybit_host(args, 3);
ops_set_halo_dirtybit3(&args[0], range);
ops_set_halo_dirtybit3(&args[1], range);
if (OPS_diags > 1) {
// Update kernel record
ops_timers_core(&c2, &t2);
OPS_kernels[79].mpi_time += t2 - t1;
OPS_kernels[79].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[79].transfer += ops_compute_transfer(dim, start, end, &arg1);
}
}
示例4: ops_par_loop_mblock_populate_kernel
//.........这里部分代码省略.........
int nthreads = omp_get_max_threads( );
#else
int nthreads = 1;
#endif
xdim0 = args[0].dat->size[0]*args[0].dat->dim;
ops_H_D_exchanges_host(args, 2);
//Halo Exchanges
ops_halo_exchanges(args,2,range);
ops_timers_core(&c2,&t2);
OPS_kernels[0].mpi_time += t2-t1;
#pragma omp parallel for
for ( int thr=0; thr<nthreads; thr++ ){
int y_size = end[1]-start[1];
char *p_a[2];
int start_i = start[1] + ((y_size-1)/nthreads+1)*thr;
int finish_i = start[1] + MIN(((y_size-1)/nthreads+1)*(thr+1),y_size);
//get address per thread
int start0 = start[0];
int start1 = start_i;
int arg_idx[2];
#ifdef OPS_MPI
arg_idx[0] = sb->decomp_disp[0]+start0;
arg_idx[1] = sb->decomp_disp[1]+start1;
#else //OPS_MPI
arg_idx[0] = start0;
arg_idx[1] = start1;
#endif //OPS_MPI
//set up initial pointers
int d_m[OPS_MAX_DIM];
#ifdef OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[0].dat->d_m[d] + OPS_sub_dat_list[args[0].dat->index]->d_im[d];
#else //OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[0].dat->d_m[d];
#endif //OPS_MPI
int base0 = dat0 * 1 *
(start0 * args[0].stencil->stride[0] - args[0].dat->base[0] - d_m[0]);
base0 = base0+ dat0 *
args[0].dat->size[0] *
(start1 * args[0].stencil->stride[1] - args[0].dat->base[1] - d_m[1]);
p_a[0] = (char *)args[0].data + base0;
p_a[1] = (char *)arg_idx;
for ( int n_y=start_i; n_y<finish_i; n_y++ ){
for ( int n_x=start[0]; n_x<start[0]+(end[0]-start[0])/SIMD_VEC; n_x++ ){
//call kernel function, passing in pointers to data -vectorised
for ( int i=0; i<SIMD_VEC; i++ ){
mblock_populate_kernel( (double * )p_a[0]+ i*1, arg_idx );
arg_idx[0]++;
}
//shift pointers to data x direction
p_a[0]= p_a[0] + (dat0 * off0_0)*SIMD_VEC;
}
for ( int n_x=start[0]+((end[0]-start[0])/SIMD_VEC)*SIMD_VEC; n_x<end[0]; n_x++ ){
//call kernel function, passing in pointers to data - remainder
mblock_populate_kernel( (double * )p_a[0], arg_idx );
//shift pointers to data x direction
p_a[0]= p_a[0] + (dat0 * off0_0);
arg_idx[0]++;
}
//shift pointers to data y direction
p_a[0]= p_a[0] + (dat0 * off0_1);
#ifdef OPS_MPI
arg_idx[0] = sb->decomp_disp[0]+start0;
#else //OPS_MPI
arg_idx[0] = start0;
#endif //OPS_MPI
arg_idx[1]++;
}
}
ops_timers_core(&c1,&t1);
OPS_kernels[0].time += t1-t2;
ops_set_dirtybit_host(args, 2);
ops_set_halo_dirtybit3(&args[0],range);
//Update kernel record
ops_timers_core(&c2,&t2);
OPS_kernels[0].mpi_time += t2-t1;
OPS_kernels[0].transfer += ops_compute_transfer(dim, range, &arg0);
}
示例5: ops_par_loop_copy
//.........这里部分代码省略.........
}
#else
for ( int n=0; n<2; n++ ){
start[n] = range[2*n];end[n] = range[2*n+1];
}
#endif
#ifdef OPS_DEBUG
ops_register_args(args, "copy");
#endif
offs[0][0] = args[0].stencil->stride[0]*1; //unit step in x dimension
offs[0][1] = off2D(1, &start[0],
&end[0],args[0].dat->size, args[0].stencil->stride) - offs[0][0];
offs[1][0] = args[1].stencil->stride[0]*1; //unit step in x dimension
offs[1][1] = off2D(1, &start[0],
&end[0],args[1].dat->size, args[1].stencil->stride) - offs[1][0];
int off0_0 = offs[0][0];
int off0_1 = offs[0][1];
int dat0 = (OPS_soa ? args[0].dat->type_size : args[0].dat->elem_size);
int off1_0 = offs[1][0];
int off1_1 = offs[1][1];
int dat1 = (OPS_soa ? args[1].dat->type_size : args[1].dat->elem_size);
//set up initial pointers and exchange halos if necessary
int base0 = args[0].dat->base_offset + (OPS_soa ? args[0].dat->type_size : args[0].dat->elem_size) * start[0] * args[0].stencil->stride[0];
base0 = base0+ (OPS_soa ? args[0].dat->type_size : args[0].dat->elem_size) *
args[0].dat->size[0] *
start[1] * args[0].stencil->stride[1];
p_a[0] = (char *)args[0].data + base0;
int base1 = args[1].dat->base_offset + (OPS_soa ? args[1].dat->type_size : args[1].dat->elem_size) * start[0] * args[1].stencil->stride[0];
base1 = base1+ (OPS_soa ? args[1].dat->type_size : args[1].dat->elem_size) *
args[1].dat->size[0] *
start[1] * args[1].stencil->stride[1];
p_a[1] = (char *)args[1].data + base1;
//initialize global variable with the dimension of dats
xdim0 = args[0].dat->size[0];
xdim1 = args[1].dat->size[0];
//Halo Exchanges
ops_H_D_exchanges_host(args, 2);
ops_halo_exchanges(args,2,range);
ops_H_D_exchanges_host(args, 2);
if (OPS_diags > 1) {
ops_timers_core(&c1,&t1);
OPS_kernels[5].mpi_time += t1-t2;
}
int n_x;
for ( int n_y=start[1]; n_y<end[1]; n_y++ ){
#pragma novector
for( n_x=start[0]; n_x<start[0]+((end[0]-start[0])/SIMD_VEC)*SIMD_VEC; n_x+=SIMD_VEC ) {
//call kernel function, passing in pointers to data -vectorised
#pragma simd
for ( int i=0; i<SIMD_VEC; i++ ){
copy( (double *)p_a[0]+ i*1*1, (double *)p_a[1]+ i*1*1 );
}
//shift pointers to data x direction
p_a[0]= p_a[0] + (dat0 * off0_0)*SIMD_VEC;
p_a[1]= p_a[1] + (dat1 * off1_0)*SIMD_VEC;
}
for ( int n_x=start[0]+((end[0]-start[0])/SIMD_VEC)*SIMD_VEC; n_x<end[0]; n_x++ ){
//call kernel function, passing in pointers to data - remainder
copy( (double *)p_a[0], (double *)p_a[1] );
//shift pointers to data x direction
p_a[0]= p_a[0] + (dat0 * off0_0);
p_a[1]= p_a[1] + (dat1 * off1_0);
}
//shift pointers to data y direction
p_a[0]= p_a[0] + (dat0 * off0_1);
p_a[1]= p_a[1] + (dat1 * off1_1);
}
if (OPS_diags > 1) {
ops_timers_core(&c2,&t2);
OPS_kernels[5].time += t2-t1;
}
ops_set_dirtybit_host(args, 2);
ops_set_halo_dirtybit3(&args[0],range);
if (OPS_diags > 1) {
//Update kernel record
ops_timers_core(&c1,&t1);
OPS_kernels[5].mpi_time += t1-t2;
OPS_kernels[5].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[5].transfer += ops_compute_transfer(dim, start, end, &arg1);
}
}
示例6: ops_par_loop_flux_calc_kernelx_execute
// host stub function
void ops_par_loop_flux_calc_kernelx_execute(ops_kernel_descriptor *desc) {
ops_block block = desc->block;
int dim = desc->dim;
int *range = desc->range;
ops_arg arg0 = desc->args[0];
ops_arg arg1 = desc->args[1];
ops_arg arg2 = desc->args[2];
ops_arg arg3 = desc->args[3];
// Timing
double t1, t2, c1, c2;
ops_arg args[4] = {arg0, arg1, arg2, arg3};
#ifdef CHECKPOINTING
if (!ops_checkpointing_before(args, 4, range, 59))
return;
#endif
if (OPS_diags > 1) {
OPS_kernels[59].count++;
ops_timers_core(&c2, &t2);
}
// compute locally allocated range for the sub-block
int start[2];
int end[2];
for (int n = 0; n < 2; n++) {
start[n] = range[2 * n];
end[n] = range[2 * n + 1];
}
#ifdef OPS_DEBUG
ops_register_args(args, "flux_calc_kernelx");
#endif
// set up initial pointers and exchange halos if necessary
int base0 = args[0].dat->base_offset;
double *__restrict__ vol_flux_x = (double *)(args[0].data + base0);
int base1 = args[1].dat->base_offset;
const double *__restrict__ xarea = (double *)(args[1].data + base1);
int base2 = args[2].dat->base_offset;
const double *__restrict__ xvel0 = (double *)(args[2].data + base2);
int base3 = args[3].dat->base_offset;
const double *__restrict__ xvel1 = (double *)(args[3].data + base3);
// initialize global variable with the dimension of dats
int xdim0_flux_calc_kernelx = args[0].dat->size[0];
int xdim1_flux_calc_kernelx = args[1].dat->size[0];
int xdim2_flux_calc_kernelx = args[2].dat->size[0];
int xdim3_flux_calc_kernelx = args[3].dat->size[0];
if (OPS_diags > 1) {
ops_timers_core(&c1, &t1);
OPS_kernels[59].mpi_time += t1 - t2;
}
#pragma omp parallel for
for (int n_y = start[1]; n_y < end[1]; n_y++) {
#ifdef intel
#pragma loop_count(10000)
#pragma omp simd aligned(vol_flux_x, xarea, xvel0, xvel1)
#else
#pragma simd
#endif
for (int n_x = start[0]; n_x < end[0]; n_x++) {
vol_flux_x[OPS_ACC0(0, 0)] =
0.25 * dt * (xarea[OPS_ACC1(0, 0)]) *
((xvel0[OPS_ACC2(0, 0)]) + (xvel0[OPS_ACC2(0, 1)]) +
(xvel1[OPS_ACC3(0, 0)]) + (xvel1[OPS_ACC3(0, 1)]));
}
}
if (OPS_diags > 1) {
ops_timers_core(&c2, &t2);
OPS_kernels[59].time += t2 - t1;
}
if (OPS_diags > 1) {
// Update kernel record
ops_timers_core(&c1, &t1);
OPS_kernels[59].mpi_time += t1 - t2;
OPS_kernels[59].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[59].transfer += ops_compute_transfer(dim, start, end, &arg1);
OPS_kernels[59].transfer += ops_compute_transfer(dim, start, end, &arg2);
OPS_kernels[59].transfer += ops_compute_transfer(dim, start, end, &arg3);
}
}
示例7: ops_par_loop_gridgen_kernel
//.........这里部分代码省略.........
double t1, t2, c1, c2;
ops_arg args[2] = {arg0, arg1};
#ifdef CHECKPOINTING
if (!ops_checkpointing_before(args, 2, range, 0))
return;
#endif
if (OPS_diags > 1) {
ops_timing_realloc(0, "gridgen_kernel");
OPS_kernels[0].count++;
ops_timers_core(&c1, &t1);
}
// compute localy allocated range for the sub-block
int start[1];
int end[1];
#ifdef OPS_MPI
sub_block_list sb = OPS_sub_block_list[block->index];
#endif // OPS_MPI
int arg_idx[1];
int arg_idx_base[1];
#ifdef OPS_MPI
if (compute_ranges(args, 2, block, range, start, end, arg_idx) < 0)
return;
#else // OPS_MPI
for (int n = 0; n < 1; n++) {
start[n] = range[2 * n];
end[n] = range[2 * n + 1];
arg_idx[n] = start[n];
}
#endif
for (int n = 0; n < 1; n++) {
arg_idx_base[n] = arg_idx[n];
}
int dat0 = args[0].dat->elem_size;
// set up initial pointers
int base0 = args[0].dat->base_offset +
(OPS_soa ? args[0].dat->type_size : args[0].dat->elem_size) *
start[0] * args[0].stencil->stride[0];
#ifdef OPS_GPU
double *p_a0 = (double *)((char *)args[0].data_d + base0);
#else
double *p_a0 = (double *)((char *)args[0].data + base0);
#endif
int *p_a1 = NULL;
int x_size = MAX(0, end[0] - start[0]);
// initialize global variable with the dimension of dats
xdim0 = args[0].dat->size[0];
if (xdim0 != xdim0_gridgen_kernel_h) {
xdim0_gridgen_kernel = xdim0;
xdim0_gridgen_kernel_h = xdim0;
}
// Halo Exchanges
#ifdef OPS_GPU
ops_H_D_exchanges_device(args, 2);
#else
ops_H_D_exchanges_host(args, 2);
#endif
ops_halo_exchanges(args, 2, range);
#ifdef OPS_GPU
ops_H_D_exchanges_device(args, 2);
#else
ops_H_D_exchanges_host(args, 2);
#endif
if (OPS_diags > 1) {
ops_timers_core(&c2, &t2);
OPS_kernels[0].mpi_time += t2 - t1;
}
gridgen_kernel_c_wrapper(p_a0, p_a1, arg_idx[0], x_size);
if (OPS_diags > 1) {
ops_timers_core(&c1, &t1);
OPS_kernels[0].time += t1 - t2;
}
#ifdef OPS_GPU
ops_set_dirtybit_device(args, 2);
#else
ops_set_dirtybit_host(args, 2);
#endif
ops_set_halo_dirtybit3(&args[0], range);
if (OPS_diags > 1) {
// Update kernel record
ops_timers_core(&c2, &t2);
OPS_kernels[0].mpi_time += t2 - t1;
OPS_kernels[0].transfer += ops_compute_transfer(dim, start, end, &arg0);
}
}
示例8: ops_par_loop_reset_field_kernel1_execute
// host stub function
void ops_par_loop_reset_field_kernel1_execute(ops_kernel_descriptor *desc) {
ops_block block = desc->block;
int dim = desc->dim;
int *range = desc->range;
ops_arg arg0 = desc->args[0];
ops_arg arg1 = desc->args[1];
ops_arg arg2 = desc->args[2];
ops_arg arg3 = desc->args[3];
// Timing
double t1, t2, c1, c2;
ops_arg args[4] = {arg0, arg1, arg2, arg3};
#ifdef CHECKPOINTING
if (!ops_checkpointing_before(args, 4, range, 139))
return;
#endif
if (OPS_diags > 1) {
OPS_kernels[139].count++;
ops_timers_core(&c2, &t2);
}
// compute locally allocated range for the sub-block
int start[3];
int end[3];
for (int n = 0; n < 3; n++) {
start[n] = range[2 * n];
end[n] = range[2 * n + 1];
}
#ifdef OPS_DEBUG
ops_register_args(args, "reset_field_kernel1");
#endif
// set up initial pointers and exchange halos if necessary
int base0 = args[0].dat->base_offset;
double *__restrict__ density0 = (double *)(args[0].data + base0);
int base1 = args[1].dat->base_offset;
const double *__restrict__ density1 = (double *)(args[1].data + base1);
int base2 = args[2].dat->base_offset;
double *__restrict__ energy0 = (double *)(args[2].data + base2);
int base3 = args[3].dat->base_offset;
const double *__restrict__ energy1 = (double *)(args[3].data + base3);
// initialize global variable with the dimension of dats
int xdim0_reset_field_kernel1 = args[0].dat->size[0];
int ydim0_reset_field_kernel1 = args[0].dat->size[1];
int xdim1_reset_field_kernel1 = args[1].dat->size[0];
int ydim1_reset_field_kernel1 = args[1].dat->size[1];
int xdim2_reset_field_kernel1 = args[2].dat->size[0];
int ydim2_reset_field_kernel1 = args[2].dat->size[1];
int xdim3_reset_field_kernel1 = args[3].dat->size[0];
int ydim3_reset_field_kernel1 = args[3].dat->size[1];
if (OPS_diags > 1) {
ops_timers_core(&c1, &t1);
OPS_kernels[139].mpi_time += t1 - t2;
}
#pragma omp parallel for collapse(2)
for (int n_z = start[2]; n_z < end[2]; n_z++) {
for (int n_y = start[1]; n_y < end[1]; n_y++) {
#ifdef intel
#pragma loop_count(10000)
#pragma omp simd aligned(density0, density1, energy0, energy1)
#else
#pragma simd
#endif
for (int n_x = start[0]; n_x < end[0]; n_x++) {
density0[OPS_ACC0(0, 0, 0)] = density1[OPS_ACC1(0, 0, 0)];
energy0[OPS_ACC2(0, 0, 0)] = energy1[OPS_ACC3(0, 0, 0)];
}
}
}
if (OPS_diags > 1) {
ops_timers_core(&c2, &t2);
OPS_kernels[139].time += t2 - t1;
}
if (OPS_diags > 1) {
// Update kernel record
ops_timers_core(&c1, &t1);
OPS_kernels[139].mpi_time += t1 - t2;
OPS_kernels[139].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[139].transfer += ops_compute_transfer(dim, start, end, &arg1);
OPS_kernels[139].transfer += ops_compute_transfer(dim, start, end, &arg2);
OPS_kernels[139].transfer += ops_compute_transfer(dim, start, end, &arg3);
}
}
示例9: ops_par_loop_PdV_kernel_nopredict
//.........这里部分代码省略.........
(void *)&arg9.data_d));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 10, sizeof(cl_mem),
(void *)&arg10.data_d));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 11, sizeof(cl_mem),
(void *)&arg11.data_d));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 12, sizeof(cl_mem),
(void *)&arg12.data_d));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 13, sizeof(cl_mem),
(void *)&arg13.data_d));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 14, sizeof(cl_mem),
(void *)&arg14.data_d));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 15, sizeof(cl_mem),
(void *)&arg15.data_d));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 16, sizeof(cl_mem),
(void *)&arg16.data_d));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 17,
sizeof(cl_double), (void *)&dt));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 18, sizeof(cl_int),
(void *)&base0));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 19, sizeof(cl_int),
(void *)&base1));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 20, sizeof(cl_int),
(void *)&base2));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 21, sizeof(cl_int),
(void *)&base3));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 22, sizeof(cl_int),
(void *)&base4));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 23, sizeof(cl_int),
(void *)&base5));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 24, sizeof(cl_int),
(void *)&base6));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 25, sizeof(cl_int),
(void *)&base7));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 26, sizeof(cl_int),
(void *)&base8));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 27, sizeof(cl_int),
(void *)&base9));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 28, sizeof(cl_int),
(void *)&base10));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 29, sizeof(cl_int),
(void *)&base11));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 30, sizeof(cl_int),
(void *)&base12));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 31, sizeof(cl_int),
(void *)&base13));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 32, sizeof(cl_int),
(void *)&base14));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 33, sizeof(cl_int),
(void *)&base15));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 34, sizeof(cl_int),
(void *)&base16));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 35, sizeof(cl_int),
(void *)&x_size));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 36, sizeof(cl_int),
(void *)&y_size));
clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[103], 37, sizeof(cl_int),
(void *)&z_size));
// call/enque opencl kernel wrapper function
clSafeCall(clEnqueueNDRangeKernel(
OPS_opencl_core.command_queue, OPS_opencl_core.kernel[103], 3, NULL,
globalWorkSize, localWorkSize, 0, NULL, NULL));
}
if (OPS_diags > 1) {
clSafeCall(clFinish(OPS_opencl_core.command_queue));
}
if (OPS_diags > 1) {
ops_timers_core(&c1, &t1);
OPS_kernels[103].time += t1 - t2;
}
ops_set_dirtybit_device(args, 17);
ops_set_halo_dirtybit3(&args[6], range);
ops_set_halo_dirtybit3(&args[10], range);
ops_set_halo_dirtybit3(&args[13], range);
if (OPS_diags > 1) {
// Update kernel record
ops_timers_core(&c2, &t2);
OPS_kernels[103].mpi_time += t2 - t1;
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg1);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg2);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg3);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg4);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg5);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg6);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg7);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg8);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg9);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg10);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg11);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg12);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg13);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg14);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg15);
OPS_kernels[103].transfer += ops_compute_transfer(dim, start, end, &arg16);
}
}
示例10: ops_par_loop_calc_dt_kernel_print
//.........这里部分代码省略.........
int base1 = 1 *
(start[0] * args[1].stencil->stride[0] - args[1].dat->base[0] - d_m[0]);
base1 = base1 + args[1].dat->size[0] *
(start[1] * args[1].stencil->stride[1] - args[1].dat->base[1] - d_m[1]);
#ifdef OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[2].dat->d_m[d] + OPS_sub_dat_list[args[2].dat->index]->d_im[d];
#else //OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[2].dat->d_m[d];
#endif //OPS_MPI
int base2 = 1 *
(start[0] * args[2].stencil->stride[0] - args[2].dat->base[0] - d_m[0]);
base2 = base2 + args[2].dat->size[0] *
(start[1] * args[2].stencil->stride[1] - args[2].dat->base[1] - d_m[1]);
#ifdef OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[3].dat->d_m[d] + OPS_sub_dat_list[args[3].dat->index]->d_im[d];
#else //OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[3].dat->d_m[d];
#endif //OPS_MPI
int base3 = 1 *
(start[0] * args[3].stencil->stride[0] - args[3].dat->base[0] - d_m[0]);
base3 = base3 + args[3].dat->size[0] *
(start[1] * args[3].stencil->stride[1] - args[3].dat->base[1] - d_m[1]);
#ifdef OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[4].dat->d_m[d] + OPS_sub_dat_list[args[4].dat->index]->d_im[d];
#else //OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[4].dat->d_m[d];
#endif //OPS_MPI
int base4 = 1 *
(start[0] * args[4].stencil->stride[0] - args[4].dat->base[0] - d_m[0]);
base4 = base4 + args[4].dat->size[0] *
(start[1] * args[4].stencil->stride[1] - args[4].dat->base[1] - d_m[1]);
#ifdef OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[5].dat->d_m[d] + OPS_sub_dat_list[args[5].dat->index]->d_im[d];
#else //OPS_MPI
for (int d = 0; d < dim; d++) d_m[d] = args[5].dat->d_m[d];
#endif //OPS_MPI
int base5 = 1 *
(start[0] * args[5].stencil->stride[0] - args[5].dat->base[0] - d_m[0]);
base5 = base5 + args[5].dat->size[0] *
(start[1] * args[5].stencil->stride[1] - args[5].dat->base[1] - d_m[1]);
ops_H_D_exchanges_device(args, 7);
ops_halo_exchanges(args,7,range);
ops_H_D_exchanges_device(args, 7);
ops_timers_core(&c1,&t1);
OPS_kernels[30].mpi_time += t1-t2;
int nthread = OPS_block_size_x*OPS_block_size_y;
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 0, sizeof(cl_mem), (void*) &arg0.data_d ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 1, sizeof(cl_mem), (void*) &arg1.data_d ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 2, sizeof(cl_mem), (void*) &arg2.data_d ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 3, sizeof(cl_mem), (void*) &arg3.data_d ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 4, sizeof(cl_mem), (void*) &arg4.data_d ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 5, sizeof(cl_mem), (void*) &arg5.data_d ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 6, sizeof(cl_mem), (void*) &arg6.data_d ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 7, nthread*sizeof(double), NULL));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 8, sizeof(cl_int), (void*) &r_bytes6 ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 9, sizeof(cl_int), (void*) &base0 ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 10, sizeof(cl_int), (void*) &base1 ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 11, sizeof(cl_int), (void*) &base2 ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 12, sizeof(cl_int), (void*) &base3 ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 13, sizeof(cl_int), (void*) &base4 ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 14, sizeof(cl_int), (void*) &base5 ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 15, sizeof(cl_int), (void*) &x_size ));
clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[30], 16, sizeof(cl_int), (void*) &y_size ));
//call/enque opencl kernel wrapper function
clSafeCall( clEnqueueNDRangeKernel(OPS_opencl_core.command_queue, OPS_opencl_core.kernel[30], 3, NULL, globalWorkSize, localWorkSize, 0, NULL, NULL) );
if (OPS_diags>1) {
clSafeCall( clFinish(OPS_opencl_core.command_queue) );
}
mvReductArraysToHost(reduct_bytes);
for ( int b=0; b<maxblocks; b++ ){
for ( int d=0; d<12; d++ ){
arg6h[d] = arg6h[d] + ((double *)arg6.data)[d+b*12];
}
}
arg6.data = (char *)arg6h;
ops_set_dirtybit_device(args, 7);
//Update kernel record
ops_timers_core(&c2,&t2);
OPS_kernels[30].time += t2-t1;
OPS_kernels[30].transfer += ops_compute_transfer(dim, range, &arg0);
OPS_kernels[30].transfer += ops_compute_transfer(dim, range, &arg1);
OPS_kernels[30].transfer += ops_compute_transfer(dim, range, &arg2);
OPS_kernels[30].transfer += ops_compute_transfer(dim, range, &arg3);
OPS_kernels[30].transfer += ops_compute_transfer(dim, range, &arg4);
OPS_kernels[30].transfer += ops_compute_transfer(dim, range, &arg5);
}
示例11: ops_par_loop_update_halo_kernel1_r1
//.........这里部分代码省略.........
d_m[d] = args[2].dat->d_m[d];
#endif
int base2 = dat2 * 1 * (start[0] * args[2].stencil->stride[0] -
args[2].dat->base[0] - d_m[0]);
base2 = base2 +
dat2 * args[2].dat->size[0] * (start[1] * args[2].stencil->stride[1] -
args[2].dat->base[1] - d_m[1]);
double *p_a2 = (double *)((char *)args[2].data + base2);
#ifdef OPS_MPI
for (int d = 0; d < dim; d++)
d_m[d] =
args[3].dat->d_m[d] + OPS_sub_dat_list[args[3].dat->index]->d_im[d];
#else
for (int d = 0; d < dim; d++)
d_m[d] = args[3].dat->d_m[d];
#endif
int base3 = dat3 * 1 * (start[0] * args[3].stencil->stride[0] -
args[3].dat->base[0] - d_m[0]);
base3 = base3 +
dat3 * args[3].dat->size[0] * (start[1] * args[3].stencil->stride[1] -
args[3].dat->base[1] - d_m[1]);
double *p_a3 = (double *)((char *)args[3].data + base3);
#ifdef OPS_MPI
for (int d = 0; d < dim; d++)
d_m[d] =
args[4].dat->d_m[d] + OPS_sub_dat_list[args[4].dat->index]->d_im[d];
#else
for (int d = 0; d < dim; d++)
d_m[d] = args[4].dat->d_m[d];
#endif
int base4 = dat4 * 1 * (start[0] * args[4].stencil->stride[0] -
args[4].dat->base[0] - d_m[0]);
base4 = base4 +
dat4 * args[4].dat->size[0] * (start[1] * args[4].stencil->stride[1] -
args[4].dat->base[1] - d_m[1]);
double *p_a4 = (double *)((char *)args[4].data + base4);
#ifdef OPS_MPI
for (int d = 0; d < dim; d++)
d_m[d] =
args[5].dat->d_m[d] + OPS_sub_dat_list[args[5].dat->index]->d_im[d];
#else
for (int d = 0; d < dim; d++)
d_m[d] = args[5].dat->d_m[d];
#endif
int base5 = dat5 * 1 * (start[0] * args[5].stencil->stride[0] -
args[5].dat->base[0] - d_m[0]);
base5 = base5 +
dat5 * args[5].dat->size[0] * (start[1] * args[5].stencil->stride[1] -
args[5].dat->base[1] - d_m[1]);
double *p_a5 = (double *)((char *)args[5].data + base5);
#ifdef OPS_MPI
for (int d = 0; d < dim; d++)
d_m[d] =
args[6].dat->d_m[d] + OPS_sub_dat_list[args[6].dat->index]->d_im[d];
#else
for (int d = 0; d < dim; d++)
d_m[d] = args[6].dat->d_m[d];
#endif
int base6 = dat6 * 1 * (start[0] * args[6].stencil->stride[0] -
args[6].dat->base[0] - d_m[0]);
base6 = base6 +
dat6 * args[6].dat->size[0] * (start[1] * args[6].stencil->stride[1] -
args[6].dat->base[1] - d_m[1]);
double *p_a6 = (double *)((char *)args[6].data + base6);
int *p_a7 = arg7h;
ops_H_D_exchanges_host(args, 8);
ops_halo_exchanges(args, 8, range);
ops_timers_core(&c1, &t1);
OPS_kernels[16].mpi_time += t1 - t2;
update_halo_kernel1_r1_c_wrapper(p_a0, p_a1, p_a2, p_a3, p_a4, p_a5, p_a6,
p_a7, x_size, y_size);
ops_timers_core(&c2, &t2);
OPS_kernels[16].time += t2 - t1;
ops_set_dirtybit_host(args, 8);
ops_set_halo_dirtybit3(&args[0], range);
ops_set_halo_dirtybit3(&args[1], range);
ops_set_halo_dirtybit3(&args[2], range);
ops_set_halo_dirtybit3(&args[3], range);
ops_set_halo_dirtybit3(&args[4], range);
ops_set_halo_dirtybit3(&args[5], range);
ops_set_halo_dirtybit3(&args[6], range);
// Update kernel record
OPS_kernels[16].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[16].transfer += ops_compute_transfer(dim, start, end, &arg1);
OPS_kernels[16].transfer += ops_compute_transfer(dim, start, end, &arg2);
OPS_kernels[16].transfer += ops_compute_transfer(dim, start, end, &arg3);
OPS_kernels[16].transfer += ops_compute_transfer(dim, start, end, &arg4);
OPS_kernels[16].transfer += ops_compute_transfer(dim, start, end, &arg5);
OPS_kernels[16].transfer += ops_compute_transfer(dim, start, end, &arg6);
}
示例12: ops_par_loop_update_halo_kernel1_b1
//.........这里部分代码省略.........
(OPS_soa ? args[6].dat->type_size : args[6].dat->elem_size) *
args[6].dat->size[0] * start[1] * args[6].stencil->stride[1];
#ifdef OPS_GPU
double *p_a6 = (double *)((char *)args[6].data_d + base6);
#else
double *p_a6 = (double *)((char *)args[6].data + base6);
#endif
#ifdef OPS_GPU
int *p_a7 = (int *)args[7].data_d;
#else
int *p_a7 = arg7h;
#endif
int x_size = MAX(0, end[0] - start[0]);
int y_size = MAX(0, end[1] - start[1]);
// initialize global variable with the dimension of dats
xdim0 = args[0].dat->size[0];
xdim1 = args[1].dat->size[0];
xdim2 = args[2].dat->size[0];
xdim3 = args[3].dat->size[0];
xdim4 = args[4].dat->size[0];
xdim5 = args[5].dat->size[0];
xdim6 = args[6].dat->size[0];
if (xdim0 != xdim0_update_halo_kernel1_b1_h ||
xdim1 != xdim1_update_halo_kernel1_b1_h ||
xdim2 != xdim2_update_halo_kernel1_b1_h ||
xdim3 != xdim3_update_halo_kernel1_b1_h ||
xdim4 != xdim4_update_halo_kernel1_b1_h ||
xdim5 != xdim5_update_halo_kernel1_b1_h ||
xdim6 != xdim6_update_halo_kernel1_b1_h) {
xdim0_update_halo_kernel1_b1 = xdim0;
xdim0_update_halo_kernel1_b1_h = xdim0;
xdim1_update_halo_kernel1_b1 = xdim1;
xdim1_update_halo_kernel1_b1_h = xdim1;
xdim2_update_halo_kernel1_b1 = xdim2;
xdim2_update_halo_kernel1_b1_h = xdim2;
xdim3_update_halo_kernel1_b1 = xdim3;
xdim3_update_halo_kernel1_b1_h = xdim3;
xdim4_update_halo_kernel1_b1 = xdim4;
xdim4_update_halo_kernel1_b1_h = xdim4;
xdim5_update_halo_kernel1_b1 = xdim5;
xdim5_update_halo_kernel1_b1_h = xdim5;
xdim6_update_halo_kernel1_b1 = xdim6;
xdim6_update_halo_kernel1_b1_h = xdim6;
}
// Halo Exchanges
#ifdef OPS_GPU
ops_H_D_exchanges_device(args, 8);
#else
ops_H_D_exchanges_host(args, 8);
#endif
ops_halo_exchanges(args, 8, range);
#ifdef OPS_GPU
ops_H_D_exchanges_device(args, 8);
#else
ops_H_D_exchanges_host(args, 8);
#endif
if (OPS_diags > 1) {
ops_timers_core(&c2, &t2);
OPS_kernels[10].mpi_time += t2 - t1;
}
update_halo_kernel1_b1_c_wrapper(p_a0, p_a1, p_a2, p_a3, p_a4, p_a5, p_a6,
p_a7, x_size, y_size);
if (OPS_diags > 1) {
ops_timers_core(&c1, &t1);
OPS_kernels[10].time += t1 - t2;
}
#ifdef OPS_GPU
ops_set_dirtybit_device(args, 8);
#else
ops_set_dirtybit_host(args, 8);
#endif
ops_set_halo_dirtybit3(&args[0], range);
ops_set_halo_dirtybit3(&args[1], range);
ops_set_halo_dirtybit3(&args[2], range);
ops_set_halo_dirtybit3(&args[3], range);
ops_set_halo_dirtybit3(&args[4], range);
ops_set_halo_dirtybit3(&args[5], range);
ops_set_halo_dirtybit3(&args[6], range);
if (OPS_diags > 1) {
// Update kernel record
ops_timers_core(&c2, &t2);
OPS_kernels[10].mpi_time += t2 - t1;
OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg1);
OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg2);
OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg3);
OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg4);
OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg5);
OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg6);
}
}
示例13: ops_par_loop_accelerate_kernel_execute
//.........这里部分代码省略.........
xarea[OPS_ACC5(0, -1, 0)] * (pressure[OPS_ACC6(0, -1, 0)] -
pressure[OPS_ACC6(-1, -1, 0)]) +
xarea[OPS_ACC5(0, 0, -1)] * (pressure[OPS_ACC6(0, 0, -1)] -
pressure[OPS_ACC6(-1, 0, -1)]) +
xarea[OPS_ACC5(0, -1, -1)] * (pressure[OPS_ACC6(0, -1, -1)] -
pressure[OPS_ACC6(-1, -1, -1)]));
yvel1[OPS_ACC8(0, 0, 0)] =
yvel0[OPS_ACC7(0, 0, 0)] -
stepbymass[OPS_ACC2(0, 0, 0)] *
(yarea[OPS_ACC9(0, 0, 0)] * (pressure[OPS_ACC6(0, 0, 0)] -
pressure[OPS_ACC6(0, -1, 0)]) +
yarea[OPS_ACC9(-1, 0, 0)] * (pressure[OPS_ACC6(-1, 0, 0)] -
pressure[OPS_ACC6(-1, -1, 0)]) +
yarea[OPS_ACC9(0, 0, -1)] * (pressure[OPS_ACC6(0, 0, -1)] -
pressure[OPS_ACC6(0, -1, -1)]) +
yarea[OPS_ACC9(-1, 0, -1)] * (pressure[OPS_ACC6(-1, 0, -1)] -
pressure[OPS_ACC6(-1, -1, -1)]));
zvel1[OPS_ACC12(0, 0, 0)] =
zvel0[OPS_ACC11(0, 0, 0)] -
stepbymass[OPS_ACC2(0, 0, 0)] *
(zarea[OPS_ACC13(0, 0, 0)] * (pressure[OPS_ACC6(0, 0, 0)] -
pressure[OPS_ACC6(0, 0, -1)]) +
zarea[OPS_ACC13(0, -1, 0)] * (pressure[OPS_ACC6(0, -1, 0)] -
pressure[OPS_ACC6(0, -1, -1)]) +
zarea[OPS_ACC13(-1, 0, 0)] * (pressure[OPS_ACC6(-1, 0, 0)] -
pressure[OPS_ACC6(-1, 0, -1)]) +
zarea[OPS_ACC13(-1, -1, 0)] *
(pressure[OPS_ACC6(-1, -1, 0)] -
pressure[OPS_ACC6(-1, -1, -1)]));
xvel1[OPS_ACC4(0, 0, 0)] =
xvel1[OPS_ACC4(0, 0, 0)] -
stepbymass[OPS_ACC2(0, 0, 0)] *
(xarea[OPS_ACC5(0, 0, 0)] * (viscosity[OPS_ACC10(0, 0, 0)] -
viscosity[OPS_ACC10(-1, 0, 0)]) +
xarea[OPS_ACC5(0, -1, 0)] * (viscosity[OPS_ACC10(0, -1, 0)] -
viscosity[OPS_ACC10(-1, -1, 0)]) +
xarea[OPS_ACC5(0, 0, -1)] * (viscosity[OPS_ACC10(0, 0, -1)] -
viscosity[OPS_ACC10(-1, 0, -1)]) +
xarea[OPS_ACC5(0, -1, -1)] *
(viscosity[OPS_ACC10(0, -1, -1)] -
viscosity[OPS_ACC10(-1, -1, -1)]));
yvel1[OPS_ACC8(0, 0, 0)] =
yvel1[OPS_ACC8(0, 0, 0)] -
stepbymass[OPS_ACC2(0, 0, 0)] *
(yarea[OPS_ACC9(0, 0, 0)] * (viscosity[OPS_ACC10(0, 0, 0)] -
viscosity[OPS_ACC10(0, -1, 0)]) +
yarea[OPS_ACC9(-1, 0, 0)] * (viscosity[OPS_ACC10(-1, 0, 0)] -
viscosity[OPS_ACC10(-1, -1, 0)]) +
yarea[OPS_ACC9(0, 0, -1)] * (viscosity[OPS_ACC10(0, 0, -1)] -
viscosity[OPS_ACC10(0, -1, -1)]) +
yarea[OPS_ACC9(-1, 0, -1)] *
(viscosity[OPS_ACC10(-1, 0, -1)] -
viscosity[OPS_ACC10(-1, -1, -1)]));
zvel1[OPS_ACC12(0, 0, 0)] =
zvel1[OPS_ACC12(0, 0, 0)] -
stepbymass[OPS_ACC2(0, 0, 0)] *
(zarea[OPS_ACC13(0, 0, 0)] * (viscosity[OPS_ACC10(0, 0, 0)] -
viscosity[OPS_ACC10(0, 0, -1)]) +
zarea[OPS_ACC13(0, -1, 0)] *
(viscosity[OPS_ACC10(0, -1, 0)] -
viscosity[OPS_ACC10(0, -1, -1)]) +
zarea[OPS_ACC13(-1, 0, 0)] *
(viscosity[OPS_ACC10(-1, 0, 0)] -
viscosity[OPS_ACC10(-1, 0, -1)]) +
zarea[OPS_ACC13(-1, -1, 0)] *
(viscosity[OPS_ACC10(-1, -1, 0)] -
viscosity[OPS_ACC10(-1, -1, -1)]));
}
}
}
if (OPS_diags > 1) {
ops_timers_core(&c2, &t2);
OPS_kernels[105].time += t2 - t1;
}
if (OPS_diags > 1) {
// Update kernel record
ops_timers_core(&c1, &t1);
OPS_kernels[105].mpi_time += t1 - t2;
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg1);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg2);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg3);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg4);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg5);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg6);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg7);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg8);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg9);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg10);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg11);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg12);
OPS_kernels[105].transfer += ops_compute_transfer(dim, start, end, &arg13);
}
}
示例14: ops_par_loop_update_halo_kernel5_minus_4_back_execute
// host stub function
void ops_par_loop_update_halo_kernel5_minus_4_back_execute(
ops_kernel_descriptor *desc) {
ops_block block = desc->block;
int dim = desc->dim;
int *range = desc->range;
ops_arg arg0 = desc->args[0];
ops_arg arg1 = desc->args[1];
ops_arg arg2 = desc->args[2];
// Timing
double t1, t2, c1, c2;
ops_arg args[3] = {arg0, arg1, arg2};
#ifdef CHECKPOINTING
if (!ops_checkpointing_before(args, 3, range, 92))
return;
#endif
if (OPS_diags > 1) {
OPS_kernels[92].count++;
ops_timers_core(&c2, &t2);
}
// compute locally allocated range for the sub-block
int start[3];
int end[3];
for (int n = 0; n < 3; n++) {
start[n] = range[2 * n];
end[n] = range[2 * n + 1];
}
#ifdef OPS_DEBUG
ops_register_args(args, "update_halo_kernel5_minus_4_back");
#endif
// set up initial pointers and exchange halos if necessary
int base0 = args[0].dat->base_offset;
double *__restrict__ vol_flux_z = (double *)(args[0].data + base0);
int base1 = args[1].dat->base_offset;
double *__restrict__ mass_flux_z = (double *)(args[1].data + base1);
const int *__restrict__ fields = (int *)args[2].data;
// initialize global variable with the dimension of dats
int xdim0_update_halo_kernel5_minus_4_back = args[0].dat->size[0];
int ydim0_update_halo_kernel5_minus_4_back = args[0].dat->size[1];
int xdim1_update_halo_kernel5_minus_4_back = args[1].dat->size[0];
int ydim1_update_halo_kernel5_minus_4_back = args[1].dat->size[1];
if (OPS_diags > 1) {
ops_timers_core(&c1, &t1);
OPS_kernels[92].mpi_time += t1 - t2;
}
#pragma omp parallel for collapse(2)
for (int n_z = start[2]; n_z < end[2]; n_z++) {
for (int n_y = start[1]; n_y < end[1]; n_y++) {
#ifdef intel
#pragma loop_count(10000)
#pragma omp simd aligned(vol_flux_z, mass_flux_z)
#else
#pragma simd
#endif
for (int n_x = start[0]; n_x < end[0]; n_x++) {
if (fields[FIELD_VOL_FLUX_Z] == 1)
vol_flux_z[OPS_ACC0(0, 0, 0)] = -vol_flux_z[OPS_ACC0(0, 0, 4)];
if (fields[FIELD_MASS_FLUX_Z] == 1)
mass_flux_z[OPS_ACC1(0, 0, 0)] = -mass_flux_z[OPS_ACC1(0, 0, 4)];
}
}
}
if (OPS_diags > 1) {
ops_timers_core(&c2, &t2);
OPS_kernels[92].time += t2 - t1;
}
if (OPS_diags > 1) {
// Update kernel record
ops_timers_core(&c1, &t1);
OPS_kernels[92].mpi_time += t1 - t2;
OPS_kernels[92].transfer += ops_compute_transfer(dim, start, end, &arg0);
OPS_kernels[92].transfer += ops_compute_transfer(dim, start, end, &arg1);
}
}
示例15: ops_par_loop_PdV_kernel_predict
//.........这里部分代码省略.........
}
//shift pointers to data x direction
p_a[0]= p_a[0] + (dat0 * off0_0)*SIMD_VEC;
p_a[1]= p_a[1] + (dat1 * off1_0)*SIMD_VEC;
p_a[2]= p_a[2] + (dat2 * off2_0)*SIMD_VEC;
p_a[3]= p_a[3] + (dat3 * off3_0)*SIMD_VEC;
p_a[4]= p_a[4] + (dat4 * off4_0)*SIMD_VEC;
p_a[5]= p_a[5] + (dat5 * off5_0)*SIMD_VEC;
p_a[6]= p_a[6] + (dat6 * off6_0)*SIMD_VEC;
p_a[7]= p_a[7] + (dat7 * off7_0)*SIMD_VEC;
p_a[8]= p_a[8] + (dat8 * off8_0)*SIMD_VEC;
p_a[9]= p_a[9] + (dat9 * off9_0)*SIMD_VEC;
p_a[10]= p_a[10] + (dat10 * off10_0)*SIMD_VEC;
p_a[11]= p_a[11] + (dat11 * off11_0)*SIMD_VEC;
p_a[12]= p_a[12] + (dat12 * off12_0)*SIMD_VEC;
p_a[13]= p_a[13] + (dat13 * off13_0)*SIMD_VEC;
}
for ( int n_x=start[0]+((end[0]-start[0])/SIMD_VEC)*SIMD_VEC; n_x<end[0]; n_x++ ){
//call kernel function, passing in pointers to data - remainder
PdV_kernel_predict( (double *)p_a[0], (double *)p_a[1], (double *)p_a[2],
(double *)p_a[3], (double *)p_a[4], (double *)p_a[5], (double *)p_a[6],
(double *)p_a[7], (double *)p_a[8], (double *)p_a[9], (double *)p_a[10],
(double *)p_a[11], (double *)p_a[12], (double *)p_a[13] );
//shift pointers to data x direction
p_a[0]= p_a[0] + (dat0 * off0_0);
p_a[1]= p_a[1] + (dat1 * off1_0);
p_a[2]= p_a[2] + (dat2 * off2_0);
p_a[3]= p_a[3] + (dat3 * off3_0);
p_a[4]= p_a[4] + (dat4 * off4_0);
p_a[5]= p_a[5] + (dat5 * off5_0);
p_a[6]= p_a[6] + (dat6 * off6_0);
p_a[7]= p_a[7] + (dat7 * off7_0);
p_a[8]= p_a[8] + (dat8 * off8_0);
p_a[9]= p_a[9] + (dat9 * off9_0);
p_a[10]= p_a[10] + (dat10 * off10_0);
p_a[11]= p_a[11] + (dat11 * off11_0);
p_a[12]= p_a[12] + (dat12 * off12_0);
p_a[13]= p_a[13] + (dat13 * off13_0);
}
//shift pointers to data y direction
p_a[0]= p_a[0] + (dat0 * off0_1);
p_a[1]= p_a[1] + (dat1 * off1_1);
p_a[2]= p_a[2] + (dat2 * off2_1);
p_a[3]= p_a[3] + (dat3 * off3_1);
p_a[4]= p_a[4] + (dat4 * off4_1);
p_a[5]= p_a[5] + (dat5 * off5_1);
p_a[6]= p_a[6] + (dat6 * off6_1);
p_a[7]= p_a[7] + (dat7 * off7_1);
p_a[8]= p_a[8] + (dat8 * off8_1);
p_a[9]= p_a[9] + (dat9 * off9_1);
p_a[10]= p_a[10] + (dat10 * off10_1);
p_a[11]= p_a[11] + (dat11 * off11_1);
p_a[12]= p_a[12] + (dat12 * off12_1);
p_a[13]= p_a[13] + (dat13 * off13_1);
}
//shift pointers to data z direction
p_a[0]= p_a[0] + (dat0 * off0_2);
p_a[1]= p_a[1] + (dat1 * off1_2);
p_a[2]= p_a[2] + (dat2 * off2_2);
p_a[3]= p_a[3] + (dat3 * off3_2);
p_a[4]= p_a[4] + (dat4 * off4_2);
p_a[5]= p_a[5] + (dat5 * off5_2);
p_a[6]= p_a[6] + (dat6 * off6_2);
p_a[7]= p_a[7] + (dat7 * off7_2);
p_a[8]= p_a[8] + (dat8 * off8_2);
p_a[9]= p_a[9] + (dat9 * off9_2);
p_a[10]= p_a[10] + (dat10 * off10_2);
p_a[11]= p_a[11] + (dat11 * off11_2);
p_a[12]= p_a[12] + (dat12 * off12_2);
p_a[13]= p_a[13] + (dat13 * off13_2);
}
ops_timers_core(&c2,&t2);
OPS_kernels[5].time += t2-t1;
ops_set_dirtybit_host(args, 14);
ops_set_halo_dirtybit3(&args[4],range);
ops_set_halo_dirtybit3(&args[8],range);
ops_set_halo_dirtybit3(&args[11],range);
//Update kernel record
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg0);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg1);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg2);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg3);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg4);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg5);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg6);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg7);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg8);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg9);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg10);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg11);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg12);
OPS_kernels[5].transfer += ops_compute_transfer(dim, range, &arg13);
}