This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Loop Vectorization
- From: sdcycling <sdcycling at cox dot net>
- To: tprince at computer dot org
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 20 Jun 2016 08:04:19 -0700
- Subject: Re: Loop Vectorization
- Authentication-results: sourceware.org; auth=none
- Authentication-results: cox.net; auth=pass (PLAIN) smtp dot auth=sdcycling at cox dot net
- References: <8E04A2EF-9140-4E84-81E7-61841073AF06 at cox dot net> <57678924 dot 7050807 at net-b dot de> <8vtq1t00B2qVqVd01vtrfL>
Hi Tim,
I am currently using MPICH. I could try MPICH in combination with OMP, but the number of processors on my workstation are currently maxed out.
The most computationally intensive loop uses derived data types within the loops that are nested 3 deep:
do concurrent (k=mg(mlev)%kb,mg(mlev):ke:1)
do concurrent (j=mg(mlev)%jb,mg(mlev):je:1)
do concurrent (i=mg(mlev)%ib,mg(mlev):ie:2)
residual= …
mgamr(mlev,ilev)%subdomain(n)%array(i,j,k)=residual …
enddo
enddo
enddo
It is a fragment of a Gauss-Seidel iteration. mlev is the multigrid level. ilev is the AMR level. n is the subdomain. The data dependency is eliminated by red-black ordering with a stride of 2 in the innermost loop. The innermost loop is not vectorizing. The specific compiler output is “note: not vectorized: control flow in loop.”
Thank you, Doug.
> On Jun 20, 2016, at 12:53 AM, Tim Prince <n8tm@aol.com> wrote:
>
> On 6/20/2016 2:11 AM, Tobias Burnus wrote:
>> Hello,
>>
>> sdcycling wrote:
>>> I am using gfortran to build a finite-difference code. How do I tell
>>> whether a do loop is being vectorized?
>> Try the -fopt-info-... options of GCC, in particular
>> -fopt-info-vec-optimized
>>
>>> Also, how do I use compiler directives in gfortran to indicate that a
>>> do loop does not have any data dependencies?
>>
>> Not as directive, but using Fortran's "DO CONCURRENT" instead of a
>> normal DO will imply this.
>>
> !$ omp simd may be useful, if your objective is simd vectorization.
>
>
> --
> Tim Prince