Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Automatic Code generation

albert2
Beginner
389 Views
I have installed the Intell Fortran Compiler 9.0 and VS Integration component. The problem is that i cannot accomplish automatic code generation for parallelization of loops. What are the steps i must follow (in the VS environment) to automatically generate parallel code? Will this feature take full advantage of my computer's dual core capabilities?

Windows Xp Professional, AMD Athlon 64 Dual Core 4200+
0 Kudos
6 Replies
TimP
Honored Contributor III
389 Views
You would enable auto-vectorization by setting -QxW. For easily parallized code, there is the -Qparallel option, which generates thread parallel OpenMP code automatically. In most practical cases, you would require -Qopenmp and OpenMP directives, to get effective threading. With the Qparallel or OpenMP code, when you set the environment variable OMP_NUM_THREADS=2 at run time, the threaded loops will use both cores.
0 Kudos
albert2
Beginner
389 Views
How do i set those options? I did set the Qparallel option from Project---->Properties but no code is generated.
0 Kudos
albert2
Beginner
389 Views
As a test for the auto parallelization i use the following lines of code:

PROGRAM console2
PARAMETER (N=100000000)
REAL A, C(N)

DO I = 1, N
A=2*I-1
C(I) = SQRT(A)
ENDDO

write(*,*) N, C(1), C(N)

END

Also the command line looks like this:

/nologo /Zi /Qunroll3 /Qparallel /Qpar_threshold:0 /recursive /reentrancy /Qopenmp /warn:all /module:"$(INTDIR)/" /object:"$(INTDIR)/" /traceback /check:bounds /libs:static /dbglibs /c

I still cannot see any code generated. What am i doing wrong?
0 Kudos
Steven_L_Intel1
Employee
389 Views
It looks as if you started with a debug configuration - you've got /Zi and /check:bounds in there - the latter would probably disable any parallelization. Removing some of those options I get this:


H:>ifort /Qunroll3 /Qparallel /Qpar_threshold:0 /recursive /reentrancy /Qopenmp t.f90
Intel Fortran Compiler for 32-bit applications, Version 9.0 Build 20060120Z Package ID: W_FC_C_9.0.029
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.

H: .f90(5) : (col. 0) remark: LOOP WAS AUTO-PARALLELIZED.

Are you looking for something else?
0 Kudos
albert2
Beginner
389 Views
OK, i removed some options as you suggested and i managed to get the "loop was paralelized message" in Bulidlog.htm file. Can i actually get to see the pararellized code? Also another question. How can i change the OMP_NUM_THREADS?
0 Kudos
Steven_L_Intel1
Employee
389 Views
You can ask for an assembly listing - I'm not sure how helpful that will be.

OMP_NUM_THREADS is an environment variable you can set before running the program. I would suggest that you read the chapter on parallel programming in the "Optimizing Applications" manual for a lot more information. You may also find /Qpar-report3 to provide additional helpful information.
0 Kudos
Reply