• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ops_set_dirtybit_device函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ops_set_dirtybit_device函数的典型用法代码示例。如果您正苦于以下问题:C++ ops_set_dirtybit_device函数的具体用法?C++ ops_set_dirtybit_device怎么用?C++ ops_set_dirtybit_device使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ops_set_dirtybit_device函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ops_par_loop_advec_cell_kernel1_zdir


//.........这里部分代码省略.........
  int y_size = MAX(0, end[1] - start[1]);
  int z_size = MAX(0, end[2] - start[2]);

  // initialize global variable with the dimension of dats
  xdim0 = args[0].dat->size[0];
  ydim0 = args[0].dat->size[1];
  xdim1 = args[1].dat->size[0];
  ydim1 = args[1].dat->size[1];
  xdim2 = args[2].dat->size[0];
  ydim2 = args[2].dat->size[1];
  xdim3 = args[3].dat->size[0];
  ydim3 = args[3].dat->size[1];
  xdim4 = args[4].dat->size[0];
  ydim4 = args[4].dat->size[1];
  xdim5 = args[5].dat->size[0];
  ydim5 = args[5].dat->size[1];
  if (xdim0 != xdim0_advec_cell_kernel1_zdir_h ||
      ydim0 != ydim0_advec_cell_kernel1_zdir_h ||
      xdim1 != xdim1_advec_cell_kernel1_zdir_h ||
      ydim1 != ydim1_advec_cell_kernel1_zdir_h ||
      xdim2 != xdim2_advec_cell_kernel1_zdir_h ||
      ydim2 != ydim2_advec_cell_kernel1_zdir_h ||
      xdim3 != xdim3_advec_cell_kernel1_zdir_h ||
      ydim3 != ydim3_advec_cell_kernel1_zdir_h ||
      xdim4 != xdim4_advec_cell_kernel1_zdir_h ||
      ydim4 != ydim4_advec_cell_kernel1_zdir_h ||
      xdim5 != xdim5_advec_cell_kernel1_zdir_h ||
      ydim5 != ydim5_advec_cell_kernel1_zdir_h) {
    xdim0_advec_cell_kernel1_zdir = xdim0;
    xdim0_advec_cell_kernel1_zdir_h = xdim0;
    ydim0_advec_cell_kernel1_zdir = ydim0;
    ydim0_advec_cell_kernel1_zdir_h = ydim0;
    xdim1_advec_cell_kernel1_zdir = xdim1;
    xdim1_advec_cell_kernel1_zdir_h = xdim1;
    ydim1_advec_cell_kernel1_zdir = ydim1;
    ydim1_advec_cell_kernel1_zdir_h = ydim1;
    xdim2_advec_cell_kernel1_zdir = xdim2;
    xdim2_advec_cell_kernel1_zdir_h = xdim2;
    ydim2_advec_cell_kernel1_zdir = ydim2;
    ydim2_advec_cell_kernel1_zdir_h = ydim2;
    xdim3_advec_cell_kernel1_zdir = xdim3;
    xdim3_advec_cell_kernel1_zdir_h = xdim3;
    ydim3_advec_cell_kernel1_zdir = ydim3;
    ydim3_advec_cell_kernel1_zdir_h = ydim3;
    xdim4_advec_cell_kernel1_zdir = xdim4;
    xdim4_advec_cell_kernel1_zdir_h = xdim4;
    ydim4_advec_cell_kernel1_zdir = ydim4;
    ydim4_advec_cell_kernel1_zdir_h = ydim4;
    xdim5_advec_cell_kernel1_zdir = xdim5;
    xdim5_advec_cell_kernel1_zdir_h = xdim5;
    ydim5_advec_cell_kernel1_zdir = ydim5;
    ydim5_advec_cell_kernel1_zdir_h = ydim5;
  }

// Halo Exchanges

#ifdef OPS_GPU
  ops_H_D_exchanges_device(args, 6);
#else
  ops_H_D_exchanges_host(args, 6);
#endif
  ops_halo_exchanges(args, 6, range);

#ifdef OPS_GPU
  ops_H_D_exchanges_device(args, 6);
#else
  ops_H_D_exchanges_host(args, 6);
#endif
  if (OPS_diags > 1) {
    ops_timers_core(&c2, &t2);
    OPS_kernels[117].mpi_time += t2 - t1;
  }

  advec_cell_kernel1_zdir_c_wrapper(p_a0, p_a1, p_a2, p_a3, p_a4, p_a5, x_size,
                                    y_size, z_size);

  if (OPS_diags > 1) {
    ops_timers_core(&c1, &t1);
    OPS_kernels[117].time += t1 - t2;
  }
#ifdef OPS_GPU
  ops_set_dirtybit_device(args, 6);
#else
  ops_set_dirtybit_host(args, 6);
#endif
  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[117].mpi_time += t2 - t1;
    OPS_kernels[117].transfer += ops_compute_transfer(dim, start, end, &arg0);
    OPS_kernels[117].transfer += ops_compute_transfer(dim, start, end, &arg1);
    OPS_kernels[117].transfer += ops_compute_transfer(dim, start, end, &arg2);
    OPS_kernels[117].transfer += ops_compute_transfer(dim, start, end, &arg3);
    OPS_kernels[117].transfer += ops_compute_transfer(dim, start, end, &arg4);
    OPS_kernels[117].transfer += ops_compute_transfer(dim, start, end, &arg5);
  }
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:101,代码来源:advec_cell_kernel1_zdir_openacc_kernel.cpp


示例2: ops_par_loop_update_halo_kernel5_plus_2_right


//.........这里部分代码省略.........
  int y_size = MAX(0,end[1]-start[1]);
  int z_size = MAX(0,end[2]-start[2]);


  int xdim0 = args[0].dat->size[0]*args[0].dat->dim;
  int ydim0 = args[0].dat->size[1];
  int xdim1 = args[1].dat->size[0]*args[1].dat->dim;
  int ydim1 = args[1].dat->size[1];

  //build opencl kernel if not already built

  buildOpenCLKernels_update_halo_kernel5_plus_2_right(
  xdim0,ydim0,xdim1,ydim1);

  //Timing
  double t1,t2,c1,c2;
  ops_timers_core(&c2,&t2);

  //set up OpenCL thread blocks
  size_t globalWorkSize[3] = {((x_size-1)/OPS_block_size_x+ 1)*OPS_block_size_x, ((y_size-1)/OPS_block_size_y + 1)*OPS_block_size_y, MAX(1,end[2]-start[2])};
  size_t localWorkSize[3] =  {OPS_block_size_x,OPS_block_size_y,1};


  int *arg2h = (int *)arg2.data;

  int consts_bytes = 0;

  consts_bytes += ROUND_UP(NUM_FIELDS*sizeof(int));

  reallocConstArrays(consts_bytes);

  consts_bytes = 0;
  arg2.data = OPS_consts_h + consts_bytes;
  arg2.data_d = OPS_consts_d + consts_bytes;
  for (int d=0; d<NUM_FIELDS; d++) ((int *)arg2.data)[d] = arg2h[d];
  consts_bytes += ROUND_UP(NUM_FIELDS*sizeof(int));
  mvConstArraysToDevice(consts_bytes);
  int dat0 = args[0].dat->elem_size;
  int dat1 = args[1].dat->elem_size;

  //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 = 1 * 
  (start[0] * args[0].stencil->stride[0] - args[0].dat->base[0] - d_m[0]);
  base0 = base0 + args[0].dat->size[0] *
  (start[1] * args[0].stencil->stride[1] - args[0].dat->base[1] - d_m[1]);
  base0 = base0 + args[0].dat->size[0] *  args[0].dat->size[1] *
  (start[2] * args[0].stencil->stride[2] - args[0].dat->base[2] - d_m[2]);

  #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 = 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]);
  base1 = base1 + 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]);


  ops_H_D_exchanges_device(args, 3);
  ops_halo_exchanges(args,3,range);
  ops_H_D_exchanges_device(args, 3);

  ops_timers_core(&c1,&t1);
  OPS_kernels[120].mpi_time += t1-t2;


  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[120], 0, sizeof(cl_mem), (void*) &arg0.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[120], 1, sizeof(cl_mem), (void*) &arg1.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[120], 2, sizeof(cl_mem), (void*) &arg2.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[120], 3, sizeof(cl_int), (void*) &base0 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[120], 4, sizeof(cl_int), (void*) &base1 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[120], 5, sizeof(cl_int), (void*) &x_size ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[120], 6, sizeof(cl_int), (void*) &y_size ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[120], 7, sizeof(cl_int), (void*) &z_size ));

  //call/enque opencl kernel wrapper function
  clSafeCall( clEnqueueNDRangeKernel(OPS_opencl_core.command_queue, OPS_opencl_core.kernel[120], 3, NULL, globalWorkSize, localWorkSize, 0, NULL, NULL) );
  if (OPS_diags>1) {
    clSafeCall( clFinish(OPS_opencl_core.command_queue) );
  }

  ops_set_dirtybit_device(args, 3);
  ops_set_halo_dirtybit3(&args[0],range);
  ops_set_halo_dirtybit3(&args[1],range);

  //Update kernel record
  ops_timers_core(&c2,&t2);
  OPS_kernels[120].time += t2-t1;
  OPS_kernels[120].transfer += ops_compute_transfer(dim, range, &arg0);
  OPS_kernels[120].transfer += ops_compute_transfer(dim, range, &arg1);
}
开发者ID:satyajammy,项目名称:OPS,代码行数:101,代码来源:update_halo_kernel5_plus_2_right_opencl_kernel.cpp


示例3: ops_par_loop_update_halo_kernel1_t2


//.........这里部分代码省略.........
  xdim5 = args[5].dat->size[0];
  ydim5 = args[5].dat->size[1];
  xdim6 = args[6].dat->size[0];
  ydim6 = args[6].dat->size[1];
  if (xdim0 != xdim0_update_halo_kernel1_t2_h ||
      ydim0 != ydim0_update_halo_kernel1_t2_h ||
      xdim1 != xdim1_update_halo_kernel1_t2_h ||
      ydim1 != ydim1_update_halo_kernel1_t2_h ||
      xdim2 != xdim2_update_halo_kernel1_t2_h ||
      ydim2 != ydim2_update_halo_kernel1_t2_h ||
      xdim3 != xdim3_update_halo_kernel1_t2_h ||
      ydim3 != ydim3_update_halo_kernel1_t2_h ||
      xdim4 != xdim4_update_halo_kernel1_t2_h ||
      ydim4 != ydim4_update_halo_kernel1_t2_h ||
      xdim5 != xdim5_update_halo_kernel1_t2_h ||
      ydim5 != ydim5_update_halo_kernel1_t2_h ||
      xdim6 != xdim6_update_halo_kernel1_t2_h ||
      ydim6 != ydim6_update_halo_kernel1_t2_h) {
    xdim0_update_halo_kernel1_t2 = xdim0;
    xdim0_update_halo_kernel1_t2_h = xdim0;
    ydim0_update_halo_kernel1_t2 = ydim0;
    ydim0_update_halo_kernel1_t2_h = ydim0;
    xdim1_update_halo_kernel1_t2 = xdim1;
    xdim1_update_halo_kernel1_t2_h = xdim1;
    ydim1_update_halo_kernel1_t2 = ydim1;
    ydim1_update_halo_kernel1_t2_h = ydim1;
    xdim2_update_halo_kernel1_t2 = xdim2;
    xdim2_update_halo_kernel1_t2_h = xdim2;
    ydim2_update_halo_kernel1_t2 = ydim2;
    ydim2_update_halo_kernel1_t2_h = ydim2;
    xdim3_update_halo_kernel1_t2 = xdim3;
    xdim3_update_halo_kernel1_t2_h = xdim3;
    ydim3_update_halo_kernel1_t2 = ydim3;
    ydim3_update_halo_kernel1_t2_h = ydim3;
    xdim4_update_halo_kernel1_t2 = xdim4;
    xdim4_update_halo_kernel1_t2_h = xdim4;
    ydim4_update_halo_kernel1_t2 = ydim4;
    ydim4_update_halo_kernel1_t2_h = ydim4;
    xdim5_update_halo_kernel1_t2 = xdim5;
    xdim5_update_halo_kernel1_t2_h = xdim5;
    ydim5_update_halo_kernel1_t2 = ydim5;
    ydim5_update_halo_kernel1_t2_h = ydim5;
    xdim6_update_halo_kernel1_t2 = xdim6;
    xdim6_update_halo_kernel1_t2_h = xdim6;
    ydim6_update_halo_kernel1_t2 = ydim6;
    ydim6_update_halo_kernel1_t2_h = ydim6;
  }

// 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[13].mpi_time += t2 - t1;
  }

  update_halo_kernel1_t2_c_wrapper(p_a0, p_a1, p_a2, p_a3, p_a4, p_a5, p_a6,
                                   p_a7, x_size, y_size, z_size);

  if (OPS_diags > 1) {
    ops_timers_core(&c1, &t1);
    OPS_kernels[13].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[13].mpi_time += t2 - t1;
    OPS_kernels[13].transfer += ops_compute_transfer(dim, start, end, &arg0);
    OPS_kernels[13].transfer += ops_compute_transfer(dim, start, end, &arg1);
    OPS_kernels[13].transfer += ops_compute_transfer(dim, start, end, &arg2);
    OPS_kernels[13].transfer += ops_compute_transfer(dim, start, end, &arg3);
    OPS_kernels[13].transfer += ops_compute_transfer(dim, start, end, &arg4);
    OPS_kernels[13].transfer += ops_compute_transfer(dim, start, end, &arg5);
    OPS_kernels[13].transfer += ops_compute_transfer(dim, start, end, &arg6);
  }
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:101,代码来源:update_halo_kernel1_t2_openacc_kernel.cpp


示例4: ops_par_loop_advec_cell_kernel4_ydir


//.........这里部分代码省略.........
    args[8].dat->size[1] *
    (start[2] * args[8].stencil->stride[2] - args[8].dat->base[2] - d_m[2]);
  #ifdef OPS_GPU
  double *p_a8 = (double *)((char *)args[8].data_d + base8);
  #else
  double *p_a8 = (double *)((char *)args[8].data + base8);
  #endif

  #ifdef OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[9].dat->d_m[d] + OPS_sub_dat_list[args[9].dat->index]->d_im[d];
  #else //OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[9].dat->d_m[d];
  #endif //OPS_MPI
  int base9 = dat9 * 1 * 
    (start[0] * args[9].stencil->stride[0] - args[9].dat->base[0] - d_m[0]);
  base9 = base9+ dat9 *
    args[9].dat->size[0] *
    (start[1] * args[9].stencil->stride[1] - args[9].dat->base[1] - d_m[1]);
  base9 = base9+ dat9 *
    args[9].dat->size[0] *
    args[9].dat->size[1] *
    (start[2] * args[9].stencil->stride[2] - args[9].dat->base[2] - d_m[2]);
  #ifdef OPS_GPU
  double *p_a9 = (double *)((char *)args[9].data_d + base9);
  #else
  double *p_a9 = (double *)((char *)args[9].data + base9);
  #endif

  #ifdef OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[10].dat->d_m[d] + OPS_sub_dat_list[args[10].dat->index]->d_im[d];
  #else //OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[10].dat->d_m[d];
  #endif //OPS_MPI
  int base10 = dat10 * 1 * 
    (start[0] * args[10].stencil->stride[0] - args[10].dat->base[0] - d_m[0]);
  base10 = base10+ dat10 *
    args[10].dat->size[0] *
    (start[1] * args[10].stencil->stride[1] - args[10].dat->base[1] - d_m[1]);
  base10 = base10+ dat10 *
    args[10].dat->size[0] *
    args[10].dat->size[1] *
    (start[2] * args[10].stencil->stride[2] - args[10].dat->base[2] - d_m[2]);
  #ifdef OPS_GPU
  double *p_a10 = (double *)((char *)args[10].data_d + base10);
  #else
  double *p_a10 = (double *)((char *)args[10].data + base10);
  #endif


  #ifdef OPS_GPU
  ops_H_D_exchanges_device(args, 11);
  #else
  ops_H_D_exchanges_host(args, 11);
  #endif
  ops_halo_exchanges(args,11,range);

  ops_timers_core(&c1,&t1);
  OPS_kernels[36].mpi_time += t1-t2;

  advec_cell_kernel4_ydir_c_wrapper(
    p_a0,
    p_a1,
    p_a2,
    p_a3,
    p_a4,
    p_a5,
    p_a6,
    p_a7,
    p_a8,
    p_a9,
    p_a10,
    x_size, y_size, z_size);

  ops_timers_core(&c2,&t2);
  OPS_kernels[36].time += t2-t1;
  #ifdef OPS_GPU
  ops_set_dirtybit_device(args, 11);
  #else
  ops_set_dirtybit_host(args, 11);
  #endif
  ops_set_halo_dirtybit3(&args[0],range);
  ops_set_halo_dirtybit3(&args[1],range);
  ops_set_halo_dirtybit3(&args[6],range);
  ops_set_halo_dirtybit3(&args[7],range);
  ops_set_halo_dirtybit3(&args[8],range);
  ops_set_halo_dirtybit3(&args[9],range);

  //Update kernel record
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg0);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg1);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg2);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg3);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg4);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg5);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg6);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg7);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg8);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg9);
  OPS_kernels[36].transfer += ops_compute_transfer(dim, range, &arg10);
}
开发者ID:satyajammy,项目名称:OPS,代码行数:101,代码来源:advec_cell_kernel4_ydir_openacc_kernel.cpp


示例5: ops_par_loop_update_halo_kernel1_b2


//.........这里部分代码省略.........
    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 = 1 * 1 * (start[0] * args[6].stencil->stride[0] -
                       args[6].dat->base[0] - d_m[0]);
  base6 = base6 +
          args[6].dat->size[0] * 1 * (start[1] * args[6].stencil->stride[1] -
                                      args[6].dat->base[1] - d_m[1]);
  base6 = base6 +
          args[6].dat->size[0] * 1 * args[6].dat->size[1] * 1 *
              (start[2] * args[6].stencil->stride[2] - args[6].dat->base[2] -
               d_m[2]);

  ops_H_D_exchanges_device(args, 8);
  ops_halo_exchanges(args, 8, range);
  ops_H_D_exchanges_device(args, 8);

  if (OPS_diags > 1) {
    ops_timers_core(&c2, &t2);
    OPS_kernels[12].mpi_time += t2 - t1;
  }

  if (globalWorkSize[0] > 0 && globalWorkSize[1] > 0 && globalWorkSize[2] > 0) {

    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 0, sizeof(cl_mem),
                              (void *)&arg0.data_d));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 1, sizeof(cl_mem),
                              (void *)&arg1.data_d));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 2, sizeof(cl_mem),
                              (void *)&arg2.data_d));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 3, sizeof(cl_mem),
                              (void *)&arg3.data_d));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 4, sizeof(cl_mem),
                              (void *)&arg4.data_d));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 5, sizeof(cl_mem),
                              (void *)&arg5.data_d));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 6, sizeof(cl_mem),
                              (void *)&arg6.data_d));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 7, sizeof(cl_mem),
                              (void *)&arg7.data_d));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 8, sizeof(cl_int),
                              (void *)&base0));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 9, sizeof(cl_int),
                              (void *)&base1));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 10, sizeof(cl_int),
                              (void *)&base2));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 11, sizeof(cl_int),
                              (void *)&base3));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 12, sizeof(cl_int),
                              (void *)&base4));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 13, sizeof(cl_int),
                              (void *)&base5));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 14, sizeof(cl_int),
                              (void *)&base6));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 15, sizeof(cl_int),
                              (void *)&x_size));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 16, sizeof(cl_int),
                              (void *)&y_size));
    clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[12], 17, sizeof(cl_int),
                              (void *)&z_size));

    // call/enque opencl kernel wrapper function
    clSafeCall(clEnqueueNDRangeKernel(
        OPS_opencl_core.command_queue, OPS_opencl_core.kernel[12], 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[12].time += t1 - t2;
  }

  ops_set_dirtybit_device(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);

  if (OPS_diags > 1) {
    // Update kernel record
    ops_timers_core(&c2, &t2);
    OPS_kernels[12].mpi_time += t2 - t1;
    OPS_kernels[12].transfer += ops_compute_transfer(dim, start, end, &arg0);
    OPS_kernels[12].transfer += ops_compute_transfer(dim, start, end, &arg1);
    OPS_kernels[12].transfer += ops_compute_transfer(dim, start, end, &arg2);
    OPS_kernels[12].transfer += ops_compute_transfer(dim, start, end, &arg3);
    OPS_kernels[12].transfer += ops_compute_transfer(dim, start, end, &arg4);
    OPS_kernels[12].transfer += ops_compute_transfer(dim, start, end, &arg5);
    OPS_kernels[12].transfer += ops_compute_transfer(dim, start, end, &arg6);
  }
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:101,代码来源:update_halo_kernel1_b2_opencl_kernel.cpp


示例6: ops_par_loop_PdV_kernel_predict


//.........这里部分代码省略.........
  base11 = base11 + args[11].dat->size[0] *
  (start[1] * args[11].stencil->stride[1] - args[11].dat->base[1] - d_m[1]);
  base11 = base11 + args[11].dat->size[0] *  args[11].dat->size[1] *
  (start[2] * args[11].stencil->stride[2] - args[11].dat->base[2] - d_m[2]);

  #ifdef OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[12].dat->d_m[d] + OPS_sub_dat_list[args[12].dat->index]->d_im[d];
  #else //OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[12].dat->d_m[d];
  #endif //OPS_MPI
  int base12 = 1 * 
  (start[0] * args[12].stencil->stride[0] - args[12].dat->base[0] - d_m[0]);
  base12 = base12 + args[12].dat->size[0] *
  (start[1] * args[12].stencil->stride[1] - args[12].dat->base[1] - d_m[1]);
  base12 = base12 + args[12].dat->size[0] *  args[12].dat->size[1] *
  (start[2] * args[12].stencil->stride[2] - args[12].dat->base[2] - d_m[2]);

  #ifdef OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[13].dat->d_m[d] + OPS_sub_dat_list[args[13].dat->index]->d_im[d];
  #else //OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[13].dat->d_m[d];
  #endif //OPS_MPI
  int base13 = 1 * 
  (start[0] * args[13].stencil->stride[0] - args[13].dat->base[0] - d_m[0]);
  base13 = base13 + args[13].dat->size[0] *
  (start[1] * args[13].stencil->stride[1] - args[13].dat->base[1] - d_m[1]);
  base13 = base13 + args[13].dat->size[0] *  args[13].dat->size[1] *
  (start[2] * args[13].stencil->stride[2] - args[13].dat->base[2] - d_m[2]);


  ops_H_D_exchanges_device(args, 14);
  ops_halo_exchanges(args,14,range);
  ops_H_D_exchanges_device(args, 14);

  ops_timers_core(&c1,&t1);
  OPS_kernels[5].mpi_time += t1-t2;


  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 0, sizeof(cl_mem), (void*) &arg0.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 1, sizeof(cl_mem), (void*) &arg1.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 2, sizeof(cl_mem), (void*) &arg2.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 3, sizeof(cl_mem), (void*) &arg3.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 4, sizeof(cl_mem), (void*) &arg4.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 5, sizeof(cl_mem), (void*) &arg5.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 6, sizeof(cl_mem), (void*) &arg6.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 7, sizeof(cl_mem), (void*) &arg7.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 8, sizeof(cl_mem), (void*) &arg8.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 9, sizeof(cl_mem), (void*) &arg9.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 10, sizeof(cl_mem), (void*) &arg10.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 11, sizeof(cl_mem), (void*) &arg11.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 12, sizeof(cl_mem), (void*) &arg12.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 13, sizeof(cl_mem), (void*) &arg13.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 14, sizeof(cl_double), (void*) &dt ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 15, sizeof(cl_int), (void*) &base0 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 16, sizeof(cl_int), (void*) &base1 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 17, sizeof(cl_int), (void*) &base2 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 18, sizeof(cl_int), (void*) &base3 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 19, sizeof(cl_int), (void*) &base4 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 20, sizeof(cl_int), (void*) &base5 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 21, sizeof(cl_int), (void*) &base6 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 22, sizeof(cl_int), (void*) &base7 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 23, sizeof(cl_int), (void*) &base8 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 24, sizeof(cl_int), (void*) &base9 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 25, sizeof(cl_int), (void*) &base10 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 26, sizeof(cl_int), (void*) &base11 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 27, sizeof(cl_int), (void*) &base12 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 28, sizeof(cl_int), (void*) &base13 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 29, sizeof(cl_int), (void*) &x_size ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 30, sizeof(cl_int), (void*) &y_size ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[5], 31, sizeof(cl_int), (void*) &z_size ));

  //call/enque opencl kernel wrapper function
  clSafeCall( clEnqueueNDRangeKernel(OPS_opencl_core.command_queue, OPS_opencl_core.kernel[5], 3, NULL, globalWorkSize, localWorkSize, 0, NULL, NULL) );
  if (OPS_diags>1) {
    clSafeCall( clFinish(OPS_opencl_core.command_queue) );
  }

  ops_set_dirtybit_device(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_timers_core(&c2,&t2);
  OPS_kernels[5].time += t2-t1;
  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);
}
开发者ID:satyajammy,项目名称:OPS,代码行数:101,代码来源:PdV_kernel_predict_opencl_kernel.cpp


示例7: ops_par_loop_generate_chunk_kernel


//.........这里部分代码省略.........
    xdim0_generate_chunk_kernel_h = xdim0;
    ydim0_generate_chunk_kernel = ydim0;
    ydim0_generate_chunk_kernel_h = ydim0;
    xdim1_generate_chunk_kernel = xdim1;
    xdim1_generate_chunk_kernel_h = xdim1;
    ydim1_generate_chunk_kernel = ydim1;
    ydim1_generate_chunk_kernel_h = ydim1;
    xdim2_generate_chunk_kernel = xdim2;
    xdim2_generate_chunk_kernel_h = xdim2;
    ydim2_generate_chunk_kernel = ydim2;
    ydim2_generate_chunk_kernel_h = ydim2;
    xdim3_generate_chunk_kernel = xdim3;
    xdim3_generate_chunk_kernel_h = xdim3;
    ydim3_generate_chunk_kernel = ydim3;
    ydim3_generate_chunk_kernel_h = ydim3;
    xdim4_generate_chunk_kernel = xdim4;
    xdim4_generate_chunk_kernel_h = xdim4;
    ydim4_generate_chunk_kernel = ydim4;
    ydim4_generate_chunk_kernel_h = ydim4;
    xdim5_generate_chunk_kernel = xdim5;
    xdim5_generate_chunk_kernel_h = xdim5;
    ydim5_generate_chunk_kernel = ydim5;
    ydim5_generate_chunk_kernel_h = ydim5;
    xdim6_generate_chunk_kernel = xdim6;
    xdim6_generate_chunk_kernel_h = xdim6;
    ydim6_generate_chunk_kernel = ydim6;
    ydim6_generate_chunk_kernel_h = ydim6;
    xdim7_generate_chunk_kernel = xdim7;
    xdim7_generate_chunk_kernel_h = xdim7;
    ydim7_generate_chunk_kernel = ydim7;
    ydim7_generate_chunk_kernel_h = ydim7;
    xdim8_generate_chunk_kernel = xdim8;
    xdim8_generate_chunk_kernel_h = xdim8;
    ydim8_generate_chunk_kernel = ydim8;
    ydim8_generate_chunk_kernel_h = ydim8;
    xdim9_generate_chunk_kernel = xdim9;
    xdim9_generate_chunk_kernel_h = xdim9;
    ydim9_generate_chunk_kernel = ydim9;
    ydim9_generate_chunk_kernel_h = ydim9;
    xdim10_generate_chunk_kernel = xdim10;
    xdim10_generate_chunk_kernel_h = xdim10;
    ydim10_generate_chunk_kernel = ydim10;
    ydim10_generate_chunk_kernel_h = ydim10;
  }

// Halo Exchanges

#ifdef OPS_GPU
  ops_H_D_exchanges_device(args, 11);
#else
  ops_H_D_exchanges_host(args, 11);
#endif
  ops_halo_exchanges(args, 11, range);

#ifdef OPS_GPU
  ops_H_D_exchanges_device(args, 11);
#else
  ops_H_D_exchanges_host(args, 11);
#endif
  if (OPS_diags > 1) {
    ops_timers_core(&c2, &t2);
    OPS_kernels[10].mpi_time += t2 - t1;
  }

  generate_chunk_kernel_c_wrapper(p_a0, p_a1, p_a2, p_a3, p_a4, p_a5, p_a6,
                                  p_a7, p_a8, p_a9, p_a10, x_size, y_size,
                                  z_size);

  if (OPS_diags > 1) {
    ops_timers_core(&c1, &t1);
    OPS_kernels[10].time += t1 - t2;
  }
#ifdef OPS_GPU
  ops_set_dirtybit_device(args, 11);
#else
  ops_set_dirtybit_host(args, 11);
#endif
  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);
  ops_set_halo_dirtybit3(&args[7], 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);
    OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg7);
    OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg8);
    OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg9);
    OPS_kernels[10].transfer += ops_compute_transfer(dim, start, end, &arg10);
  }
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:101,代码来源:generate_chunk_kernel_openacc_kernel.cpp


示例8: ops_par_loop_multidim_print_kernel


//.........这里部分代码省略.........
  int start[2];
  int end[2];
#ifdef OPS_MPI
  sub_block_list sb = OPS_sub_block_list[block->index];
  if (!sb->owned)
    return;
  for (int n = 0; n < 2; n++) {
    start[n] = sb->decomp_disp[n];
    end[n] = sb->decomp_disp[n] + sb->decomp_size[n];
    if (start[n] >= range[2 * n]) {
      start[n] = 0;
    } else {
      start[n] = range[2 * n] - start[n];
    }
    if (sb->id_m[n] == MPI_PROC_NULL && range[2 * n] < 0)
      start[n] = range[2 * n];
    if (end[n] >= range[2 * n + 1]) {
      end[n] = range[2 * n + 1] - sb->decomp_disp[n];
    } else {
      end[n] = sb->decomp_size[n];
    }
    if (sb->id_p[n] == MPI_PROC_NULL &&
        (range[2 * n + 1] > sb->decomp_disp[n] + sb->decomp_size[n]))
      end[n] += (range[2 * n + 1] - sb->decomp_disp[n] - sb->decomp_size[n]);
  }
#else  // OPS_MPI
  for (int n = 0; n < 2; n++) {
    start[n] = range[2 * n];
    end[n] = range[2 * n + 1];
  }
#endif // OPS_MPI

  int x_size = MAX(0, end[0] - start[0]);
  int y_size = MAX(0, end[1] - start[1]);

  int xdim0 = args[0].dat->size[0];

  // build opencl kernel if not already built

  buildOpenCLKernels_multidim_print_kernel(xdim0);

  // Timing
  double t1, t2, c1, c2;
  ops_timers_core(&c2, &t2);

  // set up OpenCL thread blocks
  size_t globalWorkSize[3] = {
      ((x_size - 1) / OPS_block_size_x + 1) * OPS_block_size_x,
      ((y_size - 1) / OPS_block_size_y + 1) * OPS_block_size_y, 1};
  size_t localWorkSize[3] = {OPS_block_size_x, OPS_block_size_y, 1};

  int dat0 = args[0].dat->elem_size;

  // 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 = 1 * (start[0] * args[0].stencil->stride[0] -
                   args[0].dat->base[0] - d_m[0]);
  base0 = base0 +
          args[0].dat->size[0] * (start[1] * args[0].stencil->stride[1] -
                                  args[0].dat->base[1] - d_m[1]);

  ops_H_D_exchanges_device(args, 1);
  ops_halo_exchanges(args, 1, range);
  ops_H_D_exchanges_device(args, 1);

  ops_timers_core(&c1, &t1);
  OPS_kernels[2].mpi_time += t1 - t2;

  clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[2], 0, sizeof(cl_mem),
                            (void *)&arg0.data_d));
  clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[2], 1, sizeof(cl_int),
                            (void *)&base0));
  clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[2], 2, sizeof(cl_int),
                            (void *)&x_size));
  clSafeCall(clSetKernelArg(OPS_opencl_core.kernel[2], 3, sizeof(cl_int),
                            (void *)&y_size));

  // call/enque opencl kernel wrapper function
  clSafeCall(clEnqueueNDRangeKernel(
      OPS_opencl_core.command_queue, OPS_opencl_core.kernel[2], 3, NULL,
      globalWorkSize, localWorkSize, 0, NULL, NULL));
  if (OPS_diags > 1) {
    clSafeCall(clFinish(OPS_opencl_core.command_queue));
  }

  ops_set_dirtybit_device(args, 1);

  // Update kernel record
  ops_timers_core(&c2, &t2);
  OPS_kernels[2].time += t2 - t1;
  OPS_kernels[2].transfer += ops_compute_transfer(dim, range, &arg0);
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:101,代码来源:multidim_print_kernel_opencl_kernel.cpp


示例9: ops_par_loop_update_halo_kernel1_fr2


//.........这里部分代码省略.........
    args[4].dat->size[0] *
    args[4].dat->size[1] *
    (start[2] * args[4].stencil->stride[2] - args[4].dat->base[2] - d_m[2]);
  #ifdef OPS_GPU
  double *p_a4 = (double *)((char *)args[4].data_d + base4);
  #else
  double *p_a4 = (double *)((char *)args[4].data + base4);
  #endif

  #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 = 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]);
  base5 = base5+ dat5 *
    args[5].dat->size[0] *
    args[5].dat->size[1] *
    (start[2] * args[5].stencil->stride[2] - args[5].dat->base[2] - d_m[2]);
  #ifdef OPS_GPU
  double *p_a5 = (double *)((char *)args[5].data_d + base5);
  #else
  double *p_a5 = (double *)((char *)args[5].data + base5);
  #endif

  #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 //OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[6].dat->d_m[d];
  #endif //OPS_MPI
  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]);
  base6 = base6+ dat6 *
    args[6].dat->size[0] *
    args[6].dat->size[1] *
    (start[2] * args[6].stencil->stride[2] - args[6].dat->base[2] - d_m[2]);
  #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

  #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);

  ops_timers_core(&c1,&t1);
  OPS_kernels[51].mpi_time += t1-t2;

  update_halo_kernel1_fr2_c_wrapper(
    p_a0,
    p_a1,
    p_a2,
    p_a3,
    p_a4,
    p_a5,
    p_a6,
    p_a7,
    x_size, y_size, z_size);

  ops_timers_core(&c2,&t2);
  OPS_kernels[51].time += t2-t1;
  #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);

  //Update kernel record
  OPS_kernels[51].transfer += ops_compute_transfer(dim, range, &arg0);
  OPS_kernels[51].transfer += ops_compute_transfer(dim, range, &arg1);
  OPS_kernels[51].transfer += ops_compute_transfer(dim, range, &arg2);
  OPS_kernels[51].transfer += ops_compute_transfer(dim, range, &arg3);
  OPS_kernels[51].transfer += ops_compute_transfer(dim, range, &arg4);
  OPS_kernels[51].transfer += ops_compute_transfer(dim, range, &arg5);
  OPS_kernels[51].transfer += ops_compute_transfer(dim, range, &arg6);
}
开发者ID:satyajammy,项目名称:OPS,代码行数:101,代码来源:update_halo_kernel1_fr2_openacc_kernel.cpp


示例10: ops_par_loop_initialise_chunk_kernel_y


//.........这里部分代码省略.........
  int dat1 = args[1].dat->elem_size;
  int dat2 = args[2].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];
  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];
#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 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];
#ifdef OPS_GPU
  int *p_a1 = (int *)((char *)args[1].data_d + base1);
#else
  int *p_a1 = (int *)((char *)args[1].data + base1);
#endif

  int base2 = args[2].dat->base_offset +
              (OPS_soa ? args[2].dat->type_size : args[2].dat->elem_size) *
                  start[0] * args[2].stencil->stride[0];
  base2 = base2 +
          (OPS_soa ? args[2].dat->type_size : args[2].dat->elem_size) *
              args[2].dat->size[0] * start[1] * args[2].stencil->stride[1];
#ifdef OPS_GPU
  double *p_a2 = (double *)((char *)args[2].data_d + base2);
#else
  double *p_a2 = (double *)((char *)args[2].data + base2);
#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];
  if (xdim0 != xdim0_initialise_chunk_kernel_y_h ||
      xdim1 != xdim1_initialise_chunk_kernel_y_h ||
      xdim2 != xdim2_initialise_chunk_kernel_y_h) {
    xdim0_initialise_chunk_kernel_y = xdim0;
    xdim0_initialise_chunk_kernel_y_h = xdim0;
    xdim1_initialise_chunk_kernel_y = xdim1;
    xdim1_initialise_chunk_kernel_y_h = xdim1;
    xdim2_initialise_chunk_kernel_y = xdim2;
    xdim2_initialise_chunk_kernel_y_h = xdim2;
  }

// Halo Exchanges

#ifdef OPS_GPU
  ops_H_D_exchanges_device(args, 3);
#else
  ops_H_D_exchanges_host(args, 3);
#endif
  ops_halo_exchanges(args, 3, range);

#ifdef OPS_GPU
  ops_H_D_exchanges_device(args, 3);
#else
  ops_H_D_exchanges_host(args, 3);
#endif
  if (OPS_diags > 1) {
    ops_timers_core(&c2, &t2);
    OPS_kernels[11].mpi_time += t2 - t1;
  }

  initialise_chunk_kernel_y_c_wrapper(p_a0, p_a1, p_a2, x_size, y_size);

  if (OPS_diags > 1) {
    ops_timers_core(&c1, &t1);
    OPS_kernels[11].time += t1 - t2;
  }
#ifdef OPS_GPU
  ops_set_dirtybit_device(args, 3);
#else
  ops_set_dirtybit_host(args, 3);
#endif
  ops_set_halo_dirtybit3(&args[0], range);
  ops_set_halo_dirtybit3(&args[2], range);

  if (OPS_diags > 1) {
    // Update kernel record
    ops_timers_core(&c2, &t2);
    OPS_kernels[11].mpi_time += t2 - t1;
    OPS_kernels[11].transfer += ops_compute_transfer(dim, start, end, &arg0);
    OPS_kernels[11].transfer += ops_compute_transfer(dim, start, end, &arg1);
    OPS_kernels[11].transfer += ops_compute_transfer(dim, start, end, &arg2);
  }
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:101,代码来源:initialise_chunk_kernel_y_openacc_kernel.cpp


示例11: ops_par_loop_viscosity_kernel


//.........这里部分代码省略.........
  (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]);

  #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 //OPS_MPI
  for (int d = 0; d < dim; d++) d_m[d] = args[6].dat->d_m[d];
  #endif //OPS_MPI
  int base6 = 1 * 
  (start[0] * args[6].stencil->stride[0] - args[6].dat->base[0] - d_m[0]);
  base6 = base6 + args[6].dat->size[0] *
  (start[1] * args[6].stencil->stride[1] - args[6].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[34].mpi_time += t1-t2;


  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 0, sizeof(cl_mem), (void*) &arg0.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 1, sizeof(cl_mem), (void*) &arg1.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 2, sizeof(cl_mem), (void*) &arg2.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 3, sizeof(cl_mem), (void*) &arg3.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 4, sizeof(cl_mem), (void*) &arg4.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 5, sizeof(cl_mem), (void*) &arg5.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 6, sizeof(cl_mem), (void*) &arg6.data_d ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 7, sizeof(cl_int), (void*) &base0 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 8, sizeof(cl_int), (void*) &base1 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 9, sizeof(cl_int), (void*) &base2 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 10, sizeof(cl_int), (void*) &base3 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 11, sizeof(cl_int), (void*) &base4 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 12, sizeof(cl_int), (void*) &base5 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 13, sizeof(cl_int), (void*) &base6 ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 14, sizeof(cl_int), (void*) &x_size ));
  clSafeCall( clSetKernelArg(OPS_opencl_core.kernel[34], 15, sizeof(cl_int), (void*) &y_size ));

  //call/enque opencl kernel wrapper function
  clSafeCall( clEnqueueNDRangeKernel(OPS_opencl_core.command_queue, OPS_opencl_core.kernel[34], 3, NULL, globalWorkSize, localWorkSize, 0, NULL, NULL) );
  if (OPS_diags>1) {
    clSafeCall( clFinish(OPS_opencl_core.command_queue) );
  }

  ops_set_dirtybit_device(args, 7);
  ops_set_halo_dirtybit3(&args[6],range);

  //Update kernel record
  ops_timers_core(&c2,&t2);
  OPS_kernels[34].time += t2-t1;
  OPS_kernels[34].transfer += ops_compute_transfer(dim, range, &arg0);
  OPS_kernels[34].transfer += ops_compute_transfer(dim, range, &arg1);
  OPS_kernels[34].transfer += ops_compute_transfer(dim, range, &arg2);
  OPS_kernels[34].transfer += ops_compute_transfer(dim, range, &arg3);
  OPS_kernels[34].transfer += ops_compute_transfer(dim, range, &arg4);
  OPS_kernels[34].transfer += ops_compute_transfer(dim, range, &arg5);
  OPS_kernels[34].transfer += ops_compute_transfer(dim, range, &arg6);
}
开发者ID:satyajammy,项目名称:OPS,代码行数:101,代码来源:viscosity_kernel_opencl_kernel.cpp


示例12: ops_par_loop_advec_mom_kernel_post_pre_advec_x


                      

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ops_set_halo_dirtybit3函数代码示例发布时间:2022-05-30
下一篇:
C++ ops_register_args函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap