在IVF中使用MKL的例程

在网上找了一下没找到有价值的教程,后来找到了MKL的用户手册,摘抄于此,以便以后查找,虽然是英文的,但都比较简单所以没做翻译。

如果有网友看到有疑问可留言探讨!

配置有两种方法:

比较简单的方法如下:

Automatically Linking Your Intel®VisualFortran Project with Intel®MKL

Configure yourIntel®Visual Fortran project for automatic linkingwith Intel MKL as follows:

Go to Project > Properties > Libraries > Use IntelMath Kernel Library and select Parallel,

Sequential, or Cluster as appropriate.

Specific IntelMKL libraries that link with your application may depend on more projectsettings. For details

see the Intel®Visual Fortran Compiler XE User and ReferenceGuides.


稍复杂的配置方法:

Configuring Intel®Visual Fortran to Linkwith Intel MKL

Steps for configuring Intel®Visual Fortranfor linking with Intel®Math Kernel Library (Intel®MKL) depend on

whether you installed the VisualFortran Integration(s) in Microsoft Visual Studio* component of the Intel®

Composer XE:

If you installed the integration component, see Automatically Linking Your Intel®Visual Fortran Project

with Intel®MKL.

• If you did not install theintegration component or need more control over Intel MKL libraries to link,you

canconfigure your project as follows:

1. Select Project>Properties>Linker>General>AdditionalLibrary Directories. Add architecturespecific

directoriesfor Intel MKL and OpenMP* libraries,

forexample: <mkl directory>\lib\ia32 and <ComposerXE directory>\compiler\lib\ia32

2. Select Project>Properties>Linker>Input>AdditionalDependencies.Insert names of the

requiredlibraries, for example: mkl_intel_c.lib mkl_intel_thread.libmkl_core.lib

libiomp5md.lib

3. Select Project>Properties>Debugging>Environment. Add architecture-specificpaths to dynamiclink

libraries:

• ForOpenMP* support; for example: enter PATH=%PATH%;<ComposerXE directory>\redist

\ia32\compiler

• ForIntel MKL (only if you link dynamically); for example: enter PATH=%PATH%;<ComposerXE

directory>\redist\ia32\mkl

 

Creating, Configuring, and Running the Intel VisualFortran Project

This section demonstrates how tocreate an Intel Visual Fortran project running an Intel MKL example in

Microsoft Visual Studio 2008.

The instructions below create aWin32/Debug project running one Intel MKL example in a Console window.

For details on creation of differentkinds of Microsoft Visual Studio projects, refer to MSDN Visual Studio

documentation athttp://www.microsoft.com.

To create and configure a Win32/Debugproject running the Intel MKL Fortran example with the Intel Visual

Fortran Compiler integrated intoVisual Studio, perform the following steps:

1. Create a VisualFortran Project:

a. Open VisualStudio 2008.

b. On the mainmenu, select File > New > Project to open the New Project window.

c. Select Project Types > Intel®Fortran > ConsoleApplication, then select Templates > Empty

Project. When done, inthe Name field, type <project name> for example,

MKL_PDETTF_D_TRIG_TRANSFORM_BVP, andclick OK.

The New Project window closes.

The next steps are performed insidethe Solution Explorer window. To open it, select View>Solution

Explorer from the mainmenu.

2. Add sources ofIntel MKL example to the project:

a. Right-click the Source Files folder under <project name> and select Add > ExistingItem... from

the drop-down menu.

The Add Existing Item - <project name> window opens.

b. Browse to theIntel MKL example directory, for example, <mkl directory>\examples\pdettf

\source. Select the example file and supportingfiles with extension ".f" or ".f90" (Fortran sources).

For example, select the d_trig_tforms_bvp.f90 file. For the list of supporting files ineach example

directory, see Support Files for Intel MKL Examples. Click Add.

9 Intel®Math Kernel Library for Windows* OS User'sGuide

84

The Add Existing Item - <project name> window closes, and the selected files appearin the

Source Files folder in Solution Explorer. Some examples with the "use" statements require the next

two steps.

c. Right-click the Header Files folder under <project name> and select Add > ExistingItem... from

the drop-down menu.

The Add Existing Item - <project name> window opens.

d. Browse to the <mkl directory>\include directory. Select the header files thatappear in the "use"

statements. For example, select the mkl_dfti.f90 and mkl_trig_transforms.f90 files. Click Add.

The Add Existing Item - <project name>window closes, and the selected files toappear in

theHeader Filesfolder in Solution Explorer.

The next steps adjust the propertiesof the project:

3. Select the <project name>.

4. On the mainmenu, select Project > Properties to open the <project name> Property Pages

window.

5. Set the IntelMKL include dependencies:

a. Select Configuration Properties > Fortran > General. In the right-hand part of the window,select

Additional Include Directories > > <Edit...>.

The Additional Include Directories window opens.

b. Type the IntelMKL include directory in quotes: "<mkl directory>\include". Click OK to close the

window.

6. Select Configuration Properties > Fortran > Preprocessor. In the right-hand part of the window,

select Preprocess Source File > Yes (default is No). This step is recommended because someexamples

require preprocessing.

7. Set librarydependencies:

a. Select Configuration Properties > Linker > General. In the right-hand part of the window,select

Additional Library Directories > > <Edit...>.

The Additional Library Directories window opens.

b. Type thedirectory with the Intel MKL libraries in quotes, that is, "<mkl directory>\lib

\<architecture>", where <architecture> is one of { ia32, intel64 }, for example: "<mkl

directory>\lib\ia32". (For most laptop and desktop computers <architecture> is ia32.) Click

OK to close thewindow.

c. Select Configuration Properties > Linker > Input. In the right-hand part of the window,select

Additional Dependencies and type the libraries required, for example, if <architecture> =ia32,

type mkl_intel_c.lib mkl_intel_thread.libmkl_core.lib libiomp5md.lib.

8. In the <project name> PropertyPages window, click OK to close the window.

9. Some examples donot pause before the end of execution. To see the results printed in theConsole

window, set a breakpoint at the veryend of the program or add the 'pause' statement beforethe last

'end' statement.

10.To build thesolution, select Build > Build Solution.

11.To run theexample, select Debug > Start Debugging.

The Console window opens.

12.You can see theresults of the example in the Console window. If you used 'pause' statement to pause

execution of the program, press Enter to complete the run. If you used a breakpointto pause execution

of the program, select Debug > Continue.

The Console window closes.

(摘抄自Intel MKL用户手册)

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值