# Can Fortran's 'do concurrent' replace directives for accelerated computing? (paper)

**URL:** <https://fortran-lang.discourse.group/t/can-fortrans-do-concurrent-replace-directives-for-accelerated-computing-paper/2143>\
**Category:** Uncategorized\
**Created:** [October 23, 2021, 1:17am UTC](https://fortran-lang.discourse.group/t/can-fortrans-do-concurrent-replace-directives-for-accelerated-computing-paper/2143 "2021-10-23T01:17:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [October 23, 2021, 1:17am UTC](https://fortran-lang.discourse.group/t/can-fortrans-do-concurrent-replace-directives-for-accelerated-computing-paper/2143/1 "2021-10-23T01:17:32Z")

</div>

#### [Can Fortran’s ‘do concurrent’ replace directives for accelerated computing?](https://arxiv.org/abs/2110.10151)

by [Miko M. Stulajter](https://arxiv.org/search/cs?searchtype=author&query=Stulajter%2C+M+M), [Ronald M. Caplan](https://arxiv.org/search/cs?searchtype=author&query=Caplan%2C+R+M), and [Jon A. Linker](https://arxiv.org/search/cs?searchtype=author&query=Linker%2C+J+A)  
arXiv 18 Oct 2021

> Recently, there has been growing interest in using standard language constructs (e.g. C++'s Parallel Algorithms and Fortran’s do concurrent) for accelerated computing as an alternative to directive-based APIs (e.g. OpenMP and OpenACC). These constructs have the potential to be more portable, and some compilers already (or have plans to) support such standards. Here, we look at the current capabilities, portability, and performance of replacing directives with Fortran’s do concurrent using a mini-app that currently implements OpenACC for GPU-acceleration and OpenMP for multi-core CPU parallelism. We replace as many directives as possible with do concurrent, testing various configurations and compiler options within three major compilers: GNU’s gfortran, NVIDIA’s nvfortran, and Intel’s ifort. We find that with the right compiler versions and flags, many directives can be replaced without loss of performance or portability, and, in the case of nvfortran, they can all be replaced. We discuss limitations that may apply to more complicated codes and future language additions that may mitigate them. The software and Singularity containers are publicly provided to allow the results to be reproduced.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [November 16, 2021, 3:04am UTC](https://fortran-lang.discourse.group/t/can-fortrans-do-concurrent-replace-directives-for-accelerated-computing-paper/2143/2 "2021-11-16T03:04:47Z")

</div>

It [won the best paper award](https://twitter.com/sunitachandra29/status/1460013630242631690?s=20) at the Eighth Workshop on Accelerator Programming Using Directives (WACCPD) @SC21.

---

<div class="post-metadata">

**Author:** ![CRquantum](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/crquantum/32/730_2.png) [@CRquantum](https://fortran-lang.discourse.group/u/CRquantum)\
**Post date:** [November 16, 2021, 9:18am UTC](https://fortran-lang.discourse.group/t/can-fortrans-do-concurrent-replace-directives-for-accelerated-computing-paper/2143/3 "2021-11-16T09:18:48Z")

</div>

May I ask, in order to make do concurrent really work, do I have to enable /qparallel flag or something?

 ![image](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/b/bc90834abff9f555eef91b8b6059ec006fa2f487.png)

Or, is it that do concurrent is just automatically optimized by compiler?

I use do concurrent a lot, I know it seems should be able to use multiple threads, and/or making more vectorization, but I am not very sure if it really have much difference from regular do loops in reality.

---

<div class="post-metadata">

**Author:** ![msz59](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@msz59](https://fortran-lang.discourse.group/u/msz59)\
**Post date:** [November 16, 2021, 10:35am UTC](https://fortran-lang.discourse.group/t/can-fortrans-do-concurrent-replace-directives-for-accelerated-computing-paper/2143/4 "2021-11-16T10:35:43Z")

</div>

See Table 3 in the cited paper and detailed discussion of compiler flags in section 3.3.  
For Intel compiler (I guess /Qparallel that you mention is an ifort option), they use -fopenmp flag.
