def __init__(self, kernel=None, dat_dict=None): self._dat_dict = access.DatArgStore(self._get_allowed_types(), dat_dict) self._cc = build.TMPCC self._temp_dir = runtime.BUILD_DIR if not os.path.exists(self._temp_dir): os.mkdir(self._temp_dir) self._kernel = kernel self.loop_timer = ppmd.modules.code_timer.LoopTimer() self.wrapper_timer = ppmd.opt.Timer(runtime.TIMER) self._components = None self._generate() self._lib = build.simple_lib_creator(self._generate_header_source(), self._components['LIB_SRC'], self._kernel.name, CC=self._cc) self._group = None for pd in self._dat_dict.items(): if issubclass(type(pd[1][0]), data.ParticleDat): if pd[1][0].group is not None: self._group = pd[1][0].group break
def __init__(self, kernel, dat_dict, n=None, types_map=None): self._types_map = types_map self._kernel = kernel self._dat_dict = access.DatArgStore(self._get_allowed_types(), dat_dict) # set compiler as NVCC default self._cc = cuda_build.NVCC self.loop_timer = ppmd.modules.code_timer.LoopTimer() self._components = { 'LIB_PAIR_INDEX_0': '_i', 'LIB_NAME': str(self._kernel.name) + '_wrapper' } self._group = None for pd in self._dat_dict.items(): if issubclass(type(pd[1][0]), cuda_data.ParticleDat): if pd[1][0].group is not None: self._group = pd[1][0].group break #start code creation self._generate() # Create library self._lib = cuda_build.simple_lib_creator( self._generate_header_source(), self._components['LIB_SRC'], self._components['LIB_NAME'])
def __init__(self, kernel=None, dat_dict=None): self._dat_dict = access.DatArgStore( self._get_allowed_types(), dat_dict ) self._cc = build.TMPCC self._temp_dir = runtime.BUILD_DIR if not os.path.exists(self._temp_dir): os.mkdir(self._temp_dir) self._kernel = kernel self.loop_timer = ppmd.modules.code_timer.LoopTimer() self.wrapper_timer = ppmd.opt.Timer(runtime.TIMER) self._components = {'LIB_PAIR_INDEX_0': '_i', 'LIB_PAIR_INDEX_1': '_j', 'OMP_THREAD_INDEX_SYM': '_threadid', 'LIB_NAME': str(self._kernel.name) + '_wrapper', 'LIB_HEADERS': [cgen.Include('omp.h', system=True),], 'OMP_SHARED_SYMS': []} self._gather_size_limit = 8 self._generate() self._group = None for pd in self._dat_dict.items(): if issubclass(type(pd[1][0]), data.PositionDat): self._group = pd[1][0].group break self._lib = build.simple_lib_creator(self._generate_header_source(), self._components['LIB_SRC'], self._kernel.name, CC=self._cc)
def __init__(self, kernel=None, dat_dict=None, shell_cutoff=None): self._dat_dict = access.DatArgStore(self._get_allowed_types(), dat_dict) self._cc = build.TMPCC self._kernel = kernel self.shell_cutoff = shell_cutoff self.loop_timer = modules.code_timer.LoopTimer() self.wrapper_timer = opt.Timer(runtime.TIMER) self.list_timer = opt.Timer(runtime.TIMER) self._gather_space = host.ThreadSpace(100, ctypes.c_uint8) self._generate() self._offset_list = host.Array(ncomp=27, dtype=ctypes.c_int) self._lib = build.simple_lib_creator(self._generate_header_source(), self._components['LIB_SRC'], self._kernel.name, CC=self._cc) self._group = None for pd in self._dat_dict.items(): if issubclass(type(pd[1][0]), data.PositionDat): self._group = pd[1][0].group break #assert self._group is not None, "No cell to particle map found" if self._group is not None: self._make_cell_list(self._group) self._kernel_execution_count = INT64(0) self._invocations = 0 self._jstore = [host.Array(ncomp=100, dtype=ctypes.c_int) for tx in \ range(runtime.NUM_THREADS)]
def __init__(self, kernel=None, dat_dict=None, shell_cutoff=None, sub_divide=None): self._dat_dict = access.DatArgStore( self._get_allowed_types(), dat_dict) self._cc = cuda_build.NVCC self._kernel = kernel self.shell_cutoff = shell_cutoff if sub_divide is None: rs_default = 5. else: rs_default = sub_divide self.sub_divide_size = rs_default #print "ACTUAL SUB CELL WIDTH", self.sub_divide_size self.loop_timer = ppmd.modules.code_timer.LoopTimer() self.wrapper_timer = opt.SynchronizedTimer(runtime.TIMER) self._components = {'LIB_PAIR_INDEX_0': '_i', 'LIB_PAIR_INDEX_1': '_j', 'LIB_NAME': str(self._kernel.name) + '_wrapper'} self._gather_size_limit = 4 self._generate() self._lib = cuda_build.simple_lib_creator( self._generate_header_source(), self._components['LIB_SRC'], self._kernel.name, )[self._components['LIB_NAME']] self._group = None for pd in self._dat_dict.items(): if issubclass(type(pd[1][0]), cuda_data.PositionDat): self._group = pd[1][0].group break assert self._group is not None, "No cell to particle map found" new_decomp_flag = self._group.domain.cell_decompose( self.shell_cutoff ) if new_decomp_flag: self._group.get_cell_to_particle_map().create() self._key = (self.shell_cutoff, self._group.domain, self._group.get_position_dat()) _nd = PairLoopCellByCell._cell_lists if not self._key in _nd.keys() or new_decomp_flag: _nd[self._key] = cuda_cell.SubCellOccupancyMatrix( domain=self._group.domain, cell_width=self.sub_divide_size, positions=self._group.get_position_dat(), ) self.cell_list = _nd[self._key] self._cell_list_count = 0 self._invocations = 0 # get the offset list oslist = cell.convert_offset_tuples( cell.radius_cell_decompose(shell_cutoff, self.cell_list.cell_sizes), self.cell_list.cell_array, remove_zero=True ) self.offset_list = cuda_base.Array(ncomp=len(oslist), dtype=ctypes.c_int) self.offset_list[:] = oslist[:]
def __init__(self, kernel=None, dat_dict=None, shell_cutoff=None): self._dat_dict = access.DatArgStore( self._get_allowed_types(), dat_dict) self._cc = cuda_build.NVCC self._kernel = kernel ''' if type(shell_cutoff) is not logic.Distance: shell_cutoff = logic.Distance(shell_cutoff) ''' self.shell_cutoff = shell_cutoff self.loop_timer = ppmd.modules.code_timer.LoopTimer() self.wrapper_timer = opt.SynchronizedTimer(runtime.TIMER) self._components = {'LIB_PAIR_INDEX_0': '_i', 'LIB_PAIR_INDEX_1': '_j', 'LIB_NAME': str(self._kernel.name) + '_wrapper'} self._gather_size_limit = 4 self._generate() self._lib = cuda_build.simple_lib_creator( self._generate_header_source(), self._components['LIB_SRC'], self._kernel.name, )[self._components['LIB_NAME']] self._group = None for pd in self._dat_dict.items(): if issubclass(type(pd[1][0]), cuda_data.PositionDat): self._group = pd[1][0].group break assert self._group is not None, "No cell to particle map found" new_decomp_flag = self._group.domain.cell_decompose( self.shell_cutoff ) if new_decomp_flag: self._group.get_cell_to_particle_map().create() self._key = (self.shell_cutoff, self._group.domain, self._group.get_position_dat()) _nd = PairLoopNeighbourListNSSplit._neighbour_list_dict_PNLNS_split if not self._key in _nd.keys() or new_decomp_flag: _nd[self._key] = cuda_cell.NeighbourListLayerSplit( occ_matrix=self._group.get_cell_to_particle_map(), cutoff=self.shell_cutoff ) self.neighbour_list = _nd[self._key] self._neighbourlist_count = 0 self._invocations = 0