def launch_configuration(self):
        if self._is_direct:
            per_elem_max_local_mem_req = self._max_shared_memory_needed_per_set_element
            shared_memory_offset = per_elem_max_local_mem_req * _warpsize
            if per_elem_max_local_mem_req == 0:
                wgs = _max_work_group_size
            else:
                # 16bytes local mem used for global / local indices and sizes
                # (4/8)ptr bytes for each dat buffer passed to the kernel
                # (4/8)ptr bytes for each temporary global reduction buffer
                # passed to the kernel
                # 7: 7bytes potentialy lost for aligning the shared memory
                # buffer to 'long'
                warning('temporary fix to available local memory computation (-512)')
                available_local_memory = _max_local_memory - 512
                available_local_memory -= 16
                available_local_memory -= (len(self._unique_dat_args) +
                                           len(self._all_global_non_reduction_args)) \
                    * (_address_bits / 8)
                available_local_memory -= len(
                    self._all_global_reduction_args) * (_address_bits / 8)
                available_local_memory -= 7
                ps = available_local_memory / per_elem_max_local_mem_req
                wgs = min(_max_work_group_size, (ps / _warpsize) * _warpsize)
            nwg = min(_pref_work_group_count, int(
                math.ceil(self._it_space.size / float(wgs))))
            ttc = wgs * nwg

            local_memory_req = per_elem_max_local_mem_req * wgs
            return {'thread_count': ttc,
                    'work_group_size': wgs,
                    'work_group_count': nwg,
                    'local_memory_size': local_memory_req,
                    'local_memory_offset': shared_memory_offset}
        else:
            return {'partition_size': self._i_partition_size()}
dataset/ETHPy150Open OP2/PyOP2/pyop2/opencl.py/ParLoop.launch_configuration/original