# OpenMP code implementation in gfortran and intel

**URL:** <https://fortran-lang.discourse.group/t/openmp-code-implementation-in-gfortran-and-intel/8256>\
**Category:** Help\
**Created:** [June 25, 2024, 7:51am UTC](https://fortran-lang.discourse.group/t/openmp-code-implementation-in-gfortran-and-intel/8256 "2024-06-25T07:51:11Z")\
**Posts on this page:** 1\
**Showing post:** 33

<div class="post-metadata">

**Author:** ![jkd2022](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jkd2022/32/1949_2.png) [@jkd2022](https://fortran-lang.discourse.group/u/jkd2022)\
**Post date:** [June 27, 2024, 10:35am UTC](https://fortran-lang.discourse.group/t/openmp-code-implementation-in-gfortran-and-intel/8256/33 "2024-06-27T10:35:11Z")

</div>

@PierU, @ivanpribec and others are giving you good advice!

In our code, we always use `!$OMP PARALLEL DEFAULT(SHARED)` and then go through the parallel section with a fine-tooth comb and declare all variables which should be exclusive to each thread with `!$OMP PRIVATE`. This is required because the compiler would have a hard time figuring out our intent for each variable.

Interestingly, your variables `i` and `j` are private by default because they are loop variables. See [here](https://fortran-lang.discourse.group/t/parallelization-on-gpu-with-intel-compiler/7804/35).

---

_[View the full topic](https://fortran-lang.discourse.group/t/openmp-code-implementation-in-gfortran-and-intel/8256)._
