1from ..AbstractSyntaxTree
import *
2from .CPPPrinter
import CPPPrinter
7 CPPPrinter.__init__(self, spaces_per_tab)
11 return f
"""{self.get_indent(indent_level)}#pragma omp target teams loop collapse(Dimensions + 1) device(deviceNumber)
12{data_block_assignment.assignment.print(self, indent_level)}"""
15 return f
"""{data_block_construction_from_function_call.allocation.print(self, indent_level)}
16{self.get_indent(indent_level)}#pragma omp target teams loop collapse(Dimensions) device(deviceNumber)
17{data_block_construction_from_function_call.initialisation.print(self, indent_level)}"""
21 outer_loop_index_print = data_block_unary_max.loops[0].iteration_variable.print(self)
22 outer_loop_start_print = data_block_unary_max.loops[0].iteration_start.print(self)
23 outer_loop_end_print = data_block_unary_max.loops[0].iteration_end.print(self)
25 return f
"""{self.get_indent(indent_level)}for (int {outer_loop_index_print} = {outer_loop_start_print}; {outer_loop_index_print} < {outer_loop_end_print}; {outer_loop_index_print}++) {{
26#pragma omp target teams loop collapse(Dimensions + 1) reduction(max:{data_block_unary_max.lhs.index_at([data_block_unary_max.loops[0].get_iteration_variable()]).print(self)})
27{data_block_unary_max.loops[1].print(self, indent_level + 1)}
28{self.get_indent(indent_level)}}}"""
31 type_print = memory_allocation.type.print(self)
32 lhs_print = memory_allocation.lhs.print(self)
33 size_print = memory_allocation.allocation_size.print(self)
35 if isinstance(memory_allocation.lhs, Variable):
36 return f
"""{type_print}* {lhs_print} = tarch::accelerator::GPUMemoryManager::getInstance().allocate<{type_print}>({size_print}, deviceNumber);"""
40 return f
"""{lhs_print} = tarch::accelerator::GPUMemoryManager::getInstance().allocate<{type_print}>({size_print}, deviceNumber);"""
43 lhs_print = memory_deallocation.lhs.print(self)
44 return f
"""tarch::accelerator::GPUMemoryManager::getInstance().free({lhs_print}, deviceNumber);"""
str print_memory_deallocation(self, MemoryDeallocation memory_deallocation, int indent_level=0)
print_data_block_construction_from_function_call(self, DataBlockConstructionFromFunctionCall data_block_construction_from_function_call, int indent_level=0)
str print_data_block_unary_max(self, DataBlockUnaryMax data_block_unary_max, int indent_level=0)
__init__(self, int spaces_per_tab)
str print_data_block_assignment(self, DataBlockAssignment data_block_assignment, int indent_level=0)
str print_memory_allocation(self, MemoryAllocation memory_allocation, int indent_level=0)