Reference Guide
2.5.0
|
Public Member Functions | |
def | name (self) |
def | validate (self, node, options=None) |
def | apply (self, node, options=None) |
Switches on/off the generation of an OpenCL PSy layer for a given InvokeSchedule. Additionally, it will generate OpenCL kernels for each of the kernels referenced by the Invoke. For example: >>> from psyclone.parse.algorithm import parse >>> from psyclone.psyGen import PSyFactory >>> API = "gocean1.0" >>> FILENAME = "shallow_alg.f90" # examples/gocean/eg1 >>> ast, invoke_info = parse(FILENAME, api=API) >>> psy = PSyFactory(API, distributed_memory=False).create(invoke_info) >>> schedule = psy.invokes.get('invoke_0').schedule >>> ocl_trans = GOOpenCLTrans() >>> ocl_trans.apply(schedule) >>> print(schedule.view())
Definition at line 60 of file gocean_opencl_trans.py.
def psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.apply | ( | self, | |
node, | |||
options = None |
|||
) |
Apply the OpenCL transformation to the supplied GOInvokeSchedule. This causes PSyclone to generate an OpenCL version of the corresponding PSy-layer routine. The generated code makes use of the FortCL library (https://github.com/stfc/FortCL) in order to manage the OpenCL device directly from Fortran. :param node: the InvokeSchedule to transform. :type node: :py:class:`psyclone.psyGen.GOInvokeSchedule` :param options: set of option to tune the OpenCL generation. :type options: dict of str:value or None :param bool options["enable_profiling"]: whether or not to set up the \ OpenCL environment with the profiling option enabled. :param bool options["out_of_order"]: whether or not to set up the \ OpenCL environment with the out_of_order option enabled. :param bool options["end_barrier"]: whether or not to add an OpenCL \ barrier at the end of the transformed invoke.
Reimplemented from psyclone.psyGen.Transformation.
Definition at line 222 of file gocean_opencl_trans.py.
References psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._add_divisibility_check(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._add_end_barrier(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._add_kernel_check(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._add_ready_check(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._enable_profiling, psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._generate_set_args_call(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._insert_initialise_grid_buffers(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._insert_kernel_code_in_opencl_file(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._insert_ocl_arg_setter_routine(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._insert_ocl_initialise_buffer(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._insert_ocl_read_from_device_function(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._insert_ocl_write_to_device_function(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._insert_opencl_init_routine(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._insert_write_grid_buffers(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._kernels_file, psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._max_queue_number, psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._OCL_MANAGEMENT_QUEUE, psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._out_of_order, psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._output_opencl_kernels_file(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._transformed_invokes, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata.validate(), psyclone.transformations.MoveTrans.validate(), psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.validate(), psyclone.domain.common.transformations.alg_invoke_2_psy_call_trans.AlgInvoke2PSyCallTrans.validate(), psyclone.domain.common.transformations.alg_trans.AlgTrans.validate(), psyclone.domain.common.transformations.kernel_module_inline_trans.KernelModuleInlineTrans.validate(), psyclone.domain.common.transformations.raise_psyir_2_alg_trans.RaisePSyIR2AlgTrans.validate(), psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.validate(), psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans.validate(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.validate(), psyclone.domain.gocean.transformations.raise_psyir_2_gocean_kern_trans.RaisePSyIR2GOceanKernTrans.validate(), psyclone.domain.lfric.transformations.lfric_alg_invoke_2_psy_call_trans.LFRicAlgInvoke2PSyCallTrans.validate(), psyclone.domain.lfric.transformations.raise_psyir_2_lfric_kern_trans.RaisePSyIR2LFRicKernTrans.validate(), psyclone.domain.nemo.transformations.create_nemo_invoke_schedule_trans.CreateNemoInvokeScheduleTrans.validate(), psyclone.domain.nemo.transformations.create_nemo_psy_trans.CreateNemoPSyTrans.validate(), psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans.validate(), psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans.validate(), psyclone.domain.nemo.transformations.nemo_outerarrayrange2loop_trans.NemoOuterArrayRange2LoopTrans.validate(), psyclone.psyad.transformations.assignment_trans.AssignmentTrans.validate(), psyclone.psyGen.Transformation.validate(), psyclone.psyir.transformations.acc_update_trans.ACCUpdateTrans.validate(), psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans.validate(), psyclone.psyir.transformations.arrayaccess2loop_trans.ArrayAccess2LoopTrans.validate(), psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans.validate(), psyclone.psyir.transformations.chunk_loop_trans.ChunkLoopTrans.validate(), psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans.validate(), psyclone.psyir.transformations.hoist_local_arrays_trans.HoistLocalArraysTrans.validate(), psyclone.psyir.transformations.hoist_loop_bound_expr_trans.HoistLoopBoundExprTrans.validate(), psyclone.psyir.transformations.hoist_trans.HoistTrans.validate(), psyclone.psyir.transformations.inline_trans.InlineTrans.validate(), psyclone.psyir.transformations.intrinsics.array_reduction_base_trans.ArrayReductionBaseTrans.validate(), psyclone.psyir.transformations.intrinsics.dotproduct2code_trans.DotProduct2CodeTrans.validate(), psyclone.psyir.transformations.intrinsics.intrinsic2code_trans.Intrinsic2CodeTrans.validate(), psyclone.psyir.transformations.intrinsics.matmul2code_trans.Matmul2CodeTrans.validate(), psyclone.psyir.transformations.loop_swap_trans.LoopSwapTrans.validate(), psyclone.psyir.transformations.loop_tiling_2d_trans.LoopTiling2DTrans.validate(), psyclone.psyir.transformations.loop_trans.LoopTrans.validate(), psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.validate(), psyclone.psyir.transformations.omp_taskwait_trans.OMPTaskwaitTrans.validate(), psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans.validate(), psyclone.psyir.transformations.reference2arrayrange_trans.Reference2ArrayRangeTrans.validate(), psyclone.psyir.transformations.replace_induction_variables_trans.ReplaceInductionVariablesTrans.validate(), psyclone.transformations.OMPDeclareTargetTrans.validate(), psyclone.transformations.DynamoOMPParallelLoopTrans.validate(), psyclone.transformations.Dynamo0p3OMPLoopTrans.validate(), psyclone.transformations.GOceanOMPLoopTrans.validate(), psyclone.transformations.Dynamo0p3RedundantComputationTrans.validate(), psyclone.transformations.Dynamo0p3KernelConstTrans.validate(), psyclone.transformations.ACCRoutineTrans.validate(), psyclone.transformations.KernelImportsToArguments.validate(), psyclone.domain.gocean.transformations.gocean_loop_fuse_trans.GOceanLoopFuseTrans.validate(), psyclone.domain.lfric.transformations.lfric_loop_fuse_trans.LFRicLoopFuseTrans.validate(), psyclone.psyir.transformations.loop_fuse_trans.LoopFuseTrans.validate(), psyclone.domain.gocean.transformations.gocean_extract_trans.GOceanExtractTrans.validate(), psyclone.domain.lfric.transformations.lfric_extract_trans.LFRicExtractTrans.validate(), psyclone.psyir.transformations.extract_trans.ExtractTrans.validate(), psyclone.psyir.transformations.nan_test_trans.NanTestTrans.validate(), psyclone.psyir.transformations.read_only_verify_trans.ReadOnlyVerifyTrans.validate(), psyclone.transformations.ParallelRegionTrans.validate(), psyclone.transformations.OMPParallelTrans.validate(), psyclone.transformations.ACCParallelTrans.validate(), psyclone.transformations.ACCKernelsTrans.validate(), psyclone.transformations.ACCDataTrans.validate(), psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.validate(), psyclone.psyir.transformations.region_trans.RegionTrans.validate(), and psyclone.transformations.ACCEnterDataTrans.validate().
def psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.name | ( | self | ) |
:returns: the name of this transformation. :rtype: str
Reimplemented from psyclone.psyGen.Transformation.
Definition at line 100 of file gocean_opencl_trans.py.
def psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.validate | ( | self, | |
node, | |||
options = None |
|||
) |
Checks that the supplied InvokeSchedule is valid and that an OpenCL version of it can be generated. :param node: the Schedule to check. :type node: :py:class:`psyclone.psyGen.InvokeSchedule` :param options: a dictionary with options for transformations. :type options: dict of str:value or None :param bool options["enable_profiling"]: whether or not to set up the \ OpenCL environment with the profiling option enabled. :param bool options["out_of_order"]: whether or not to set up the \ OpenCL environment with the out_of_order option enabled. :param bool options["end_barrier"]: whether or not to add an OpenCL \ barrier at the end of the transformed invoke. :raises TransformationError: if the InvokeSchedule is not for the \ GOcean1.0 API. :raises TransformationError: if any of the kernels have arguments \ which are passed as a literal. :raises TransformationError: if any of the provided options is invalid. :raises TransformationError: if any of the provided options is not \ compatible with a previous OpenCL environment. :raises TransformationError: if any kernel in this invoke has a \ global variable used by an import. :raises TransformationError: if any kernel does not iterate over \ the whole grid.
Reimplemented from psyclone.psyGen.Transformation.
Definition at line 107 of file gocean_opencl_trans.py.
References psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._enable_profiling, psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._out_of_order, and psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans._transformed_invokes.