def warm_up(self): """ Give the functions a chance to compile. """ warm_up_arrays = create_arrays((1, 1, 1), self.dtype) add_arrays(*warm_up_arrays[:2]) background_correction(*warm_up_arrays, MINIMUM_PIXEL_VALUE, MAXIMUM_PIXEL_VALUE)
def warm_up(self): """ Give the CUDA functions a chance to compile. """ warm_up_arrays = create_arrays((1, 1, 1), self.dtype) add_arrays(*warm_up_arrays) background_correction(*warm_up_arrays, np.empty_like(warm_up_arrays[0]), MINIMUM_PIXEL_VALUE, MAXIMUM_PIXEL_VALUE)
def warm_up(self): """ Give CUDA an opportunity to compile these functions? """ warm_up_arrays = [ cp.asarray(cpu_array) for cpu_array in create_arrays((1, 1, 1), self.dtype) ] cupy_background_correction(*warm_up_arrays) cupy_add_arrays(*warm_up_arrays[:2])
def warm_up(self): warm_up_size = (1, 1, 1) cpu_arrays = create_arrays(warm_up_size, DTYPE) gpu_arrays = self._send_arrays_to_gpu(cpu_arrays) BackgroundCorrectionKernel( gpu_arrays[0], gpu_arrays[1], gpu_arrays[2], MINIMUM_PIXEL_VALUE, MAXIMUM_PIXEL_VALUE, ) AddArraysKernel(gpu_arrays[0], gpu_arrays[1])
def _warm_up(self): image_stack = create_arrays((3, 3, 3), self.dtype)[0] filter_size = 3 single_image = image_stack[0] padded_image = create_padded_array(single_image, filter_size) gpu_image, gpu_padded_image = self._send_arrays_to_gpu_without_pinned_memory( [single_image, padded_image]) cupy_two_dim_median_filter(gpu_image, gpu_padded_image, filter_size) padded_image_stack = create_padded_array(image_stack, filter_size // 2) gpu_image_stack, gpu_padded_image_stack = self._send_arrays_to_gpu_without_pinned_memory( [image_stack, padded_image_stack]) cupy_image_stack_median_filter(gpu_image_stack, gpu_padded_image_stack, filter_size)
def warm_up(self): warm_up_size = (2, 2, 2) cpu_data_array = create_arrays(warm_up_size, DTYPE)[0] filter_height = 3 filter_width = 3 pad_height = filter_height // 2 pad_width = filter_width // 2 padded_cpu_array = np.pad( cpu_data_array, pad_width=((0, 0), (pad_height, pad_height), (pad_width, pad_width)), mode=REFLECT_MODE, ) gpu_data_array, gpu_padded_array = self._send_arrays_to_gpu( [cpu_data_array, padded_cpu_array]) pycuda_median_filter(gpu_data_array, gpu_padded_array, filter_height, filter_width)