Programming models

Loki directives

Loki uses an internal set of directives as an intermediate annotation for data movement and parallelisation concepts. Transformations, such as the SCCAnnotateTransformation, insert these directives, or they can be written into the original Fortran source code. The PragmaModelTransformation should be used, as one of the final steps in a processing pipeline, to translate these directives to the corresponding instructions for the chosen programming model.

Currently, Loki supports OpenACC and some OpenMP. The following table gives a summary of how Loki directives are translated to the corresponding pragmas in either programming model:

Loki generic pragmas to pragma model mapping

Loki

OpenACC

OMP-GPU

create device(...)

declare create(...)

update device(...) host(...)

update device(...) self(...)

unstructured-data in(...) create(...)

enter data copyin(...) create(...)

target enter data map(to: ...) map(alloc: ...)

end unstructured-data out(...) delete(...)

exit data copyout(...) delete(...)

target exit data map(from: ...) map(delete: ...) map(release: ... ???)

structured-data inout(...) in(...) out(...) create(...)

data copy(...) copyin(...) copyout(...) create(...)

target data map(tofrom: ...) map(to: ...) map(from: ...)

end structured-data inout(...) in(...) out(...)

end data

end target data

loop gang private(...) vlength(...)

parallel loop gang private(...) vector_length(...)

target teams distribute thread_limit(...) ???

end loop gang

end parallel loop

end target teams distribute

loop vector private(...) reduction(...)

loop vector private(...) reduction(...)

parallel do

end loop vector

end parallel do

loop seq

loop seq

end loop seq

routine vector

routine vector

routine seq

routine seq

declare target

data device-present vars(...)

data present()

device-present vars (...)

data present(...)

end device-present vars(...)

end data

device-ptr vars (...)

data deviceptr(...)

end device-ptr vars(...)

end data