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

Pls Help: VF multithread Programing

wisperless
Beginner
422 Views

I am a beginner of VF multithread programming. Can anyone give me a sample code how to parallel calculating the summation of 100 numbers, such as one part for the summation from 1 to 50,the other from51 to 100? Thank you :)

Calculating the summation of 100 numbers from 1 to 100

VF sequential code:

integer sum

sum=0

do i=1, 100

sum=sum+i

enddo

0 Kudos
7 Replies
Steven_L_Intel1
Employee
422 Views
This particular code is faster to compute in a single thread. Let me suggest that you read through the chapter on parallel programming in the "Optimizing Applications" section of the Intel Fortran on-disk documentation.
0 Kudos
wisperless
Beginner
422 Views

Steve,

Thank you for your reply and I agree with you in my particular sample code. But I met thelow calculation speed probemwhenI tried to calcuate the summation over ten throusands of numbers in several timesin a real-time application.Thus I am trying to switch to the multithreads to improve the speed.

Icould not find the document you mentioned in the VF folder since I downloaded the VF after I placedmy order online. Could you please give me a link for that? I really appreciate your help.

0 Kudos
Steven_L_Intel1
Employee
422 Views

The particular kind of code you have is best done using OpenMP and with a REDUCTION clause. To see the documentation I referred to, Start > All Programs > Intel Software Development Tools > Intel Fortran Compiler 9.1 > Documentation. You can also select Help..Intel Visual Fortran Help in Visual Studio.

Under "Document", click "Intel Visual Fortran Compiler Documentation." Click on the + by "Optimizing Applications" and then "Parallel Programming". Read from there.

0 Kudos
wisperless
Beginner
422 Views

Steve,

Thank you for your help. I am working on that section now. :)

One more question here. If I use OpenMP and with a REDUCTION cluase, do I need to install any other add-in components? VF6.5 supports OpenMP either?

Thanks,

Rachel

0 Kudos
Steven_L_Intel1
Employee
422 Views

Rachel,

I am confused by your mention of "VF6.5". That would suggest you are using Compaq Visual Fortran (from six years ago), which does not support OpenMP. Compaq Visual Fortran was also never available as a download (at least not legally!)

If you are using Intel Visual Fortran (9.1 is the current version), there is no add-in component needed. The normal compiler supports OpenMP.

0 Kudos
wisperless
Beginner
422 Views

Steve,

Sorry for the confusion that I brought you. We had been using VF6.5 to develop the projects till recently we switched to VF9.1(we did purchase the license). The reason I mentioned "VF6.5" is because I hope I could do some extension of my old codebased on the VF6.5 compiler(I am not sure how much effort it takes converting from VF6.5 to VF9.1).

I really appreciate your kind assistance and happy holidays!

Rachel

0 Kudos
Steven_L_Intel1
Employee
422 Views

Rachel,

Not a problem. Please read my white paper on migrating from CVF.

0 Kudos
Reply