Fortran Program Development with Visual Studio* 2005 ~ Use Intel Visual Fortran with Visual Studio* ~ 31/Oct/2006 Software &Solutions group *
Agenda Features of Intel Fortran Compiler Integrate with Visual Studio* Make a simple Fortran Project Utilize Debug Facility of Visual Studio* Utilize Intel VTune Performance Analyzer and Intel Threading Tool. Utilize Intel Math Kernel Library 2 Intel Software Development Products
Intel Fortran Compiler Execute Software in top speed Microsoft Visual Studio* Integration Compaq Visual Fortran* Compatibility Supports following Intel Processor 32bit Processors Intel EM64T and Intel Itanium 2 Processor Family Dual-Core Intel Xeon processor 5100 series Intel Core 2 Duo processor Intel Core 2 Extreme processor Dual-Core Intel Itanium 2 9000 sequence Dual-Core Intel Xeon processor 7100 series Support for Streaming SIMD Extensions (SSE2 and SSE3) Support for Multi core Processors Support for Auto-parallelization and OpenMP* Support for AMD* Opteron* and Athlon* Processor Intel Code Coverage and Intel Test Prioritization Tools Intel Visual Fortran Windows Professional Edition is packaged with Numerics* IMSL* library Fortran 77/90/95 and 2003 features ISO(ISO/IEC 1539:1991 ISO/IEC 1539-1:1997) ANSI X3.9-1978 Compatible Support Windows* Linux* Mac* 64bit Multicore AMD* Intel Fortran Compiler 3 Intel Software Development Products
Intel Fortran Compiler High Level Optimization Facility High Level Optimization(HLO) Vectorization Auto-Parallelization Parallelization by OpenMP* Inter Procedure Optimization Profile Guided Optimization 4 Intel Software Development Products
Auto-Parallelization The Compiler Auto-Parallelization is implicitly parallelized The Compiler will do automatic threading of loop and other structures Focus on loop unrolling and splitting 5 Intel Software Development Products
Auto-Parallelization - A Example for (i=1; i<100; i++) { a[i] = a[i] + b[i] * c[i]; } Auto- Parallelize // Thread 1 for (i=1; i<50; i++) { a[i] = a[i] + b[i] * c[i]; } // Thread 2 for (i=50; i<100; i++) { a[i] = a[i] + b[i] * c[i]; } 6 Intel Software Development Products
What's OpenMP*? www.openmp.org Parallel Programming Model for shared memory multiprocessors Application Program Interface (API) Fortran 77 Fortran 90 C and C++ Support Linux* and Windows* Standardize loop level parallel processing Support coarse grain parallel processing No need to have separate Sources for Serial or Parallel version of your code Main API component Compiler Directives Runtime Library routine Environment Variables 7 Intel Software Development Products
Programming Model of OpenMP* Thread-based Parallelization Explicit Parallelism Fork-join Model Based on Directives or Pragmas Dynamic Threading 8 Intel Software Development Products
Fork-join Model Parallelization Master Thread will create a team of threads by needs You can add Parallel processing incrementally. So, you can evolve serial program to parallel program Master Thread Parallel Execution Region 9 Intel Software Development Products
OpenMP* Directive Syntax Almost All OpenMP syntax is defined by Compiler directives or pragmas Pragma syntax for C or C++ : #pragma omp construct [clause [clause] ] Directive syntax for Fortran (Use one of them): C$OMP construct [clause [clause] ]!$OMP construct [clause [clause] ] *$OMP construct [clause [clause] ] Include file and OpenMP library module #include omp.h use omp_lib 10 Intel Software Development Products
OpenMP* - Basic Syntax Application is composed of serial section and parallel section. Thread will be made by combination of parallel pragmas Data will categorized as shared among threads or private to a thread C$OMP PARALLEL Thread 1 Thread 2 Thread 3 C$OMP END PARALLEL C$OMP PARALLEL //This region will be parallelized C$OMP END PARALLEL 11 Intel Software Development Products
OpenMP: Example of working queue exteinsion To Enable below processing compiler will make task queue: Recursive function Linked List, etc LIST p; #pragma intel omp parallel taskq shared(p) { while (p!= NULL) { #pragma intel omp task captureprivate(p) do_work1(p); p = p->next; } } Intel Software Development Products
Make Fortran Project Choose "インテル Fortran プロジェクト" 13 Intel Software Development Products
Utilize Visual Studio* Facility Debugging of Fortran Program 14 Intel Software Development Products
Set Compiler Options Set " 構 成 プロパティー" 15 Intel Software Development Products
Intel Math Kernel Library 8.1 A Highly Optimized and Thread Safe Math libraries Multi-core optimizations Thread safe Highly scale in multi processor environment Identify Processor at runtime Support for C and Fortran call One package for All Intel Processors Loyalty free redistribution BLAS LAPACK Sparse Solvers Fast Fourier Transforms Vector Math Support Windows* 64bit Multi-core AMD* Intel MKL 16 Intel Software Development Products
Intel Math Kernel Library Cluster Edition 8.1 ScaLAPACK for Windows* CCS Cluster (Scalable LAPACK) LAPACK routine for distributed computer Features: Support for Microsoft Windows* MPI Tested on Ethernet Myrinet* InfiniBand* PBLAS(Parallel BLAS)and BLACS (Basic Linear Algebra Communication Subprograms) BLAS LAPACK ScaLAPACK Sparse Solvers Fast Fourier Transforms Vector Math 17 Intel Software Development Products
Demo Compare Performance of vectorized and auto-parallelized code. 18 Intel Software Development Products
19 Intel Software Development Products