| January 28, 2012 7:00 AM PST | |
This tutorial is intended to show the quick way using XCode 4.0 and Intel® Fortran Compiler XE 12.1, but we hope that it will be helpful for users of the other versions. Here is the fortran sample
For gernal link way, please refer to
Compiling and linking MKL with Xcode*
How to link application against Intel MKL using XCode IDE
1. Create a new Xcode* project
a) Copy sample source code: dgemmx.f and common_func.f from <mkl install directory /examples/blas/source> to your work directory, for example, /Users/yhu5/blas.
b) Launch the Xcode application, typically found in the Developer > Applications folder.
c) In Xcode Menu, select File > New > New Project.... , The New Project Assistant window opens. Select Application in the left pane. Select a template, for example, Command Line Tool, and click Next. Name your project, for example, MKL_dgemm_f, and select a type C. Click Next. Specify a directory for your project , For example, /Users/yhu5/blas. Click Create.
d) Xcode creates the named project directory, with an .xcodeproj extension and several new source files like main.c etc. Remove main.c, etc. file and add dgemmx.f and common_func.f into ‘Source' project folder.
Each Xcode project has its own Project Editor window that displays project source files, targets, and executables.
2. Setting MKL Options in Xcode IDE
In the Xcode project, select the target and click Build Setting. Under the Build Settings tab, click All. Scroll down until you see IFORT_MKL, Select "Use threaded Intel® Math Kernel Library (or "Use non-thread Intel @ Math Kernal Library.)
3. Build and Run the Project
Select Product > Build. Or Click the ‘Run' button on project tools bar, the project will build successfully.
But may run with error message dyld: Library not loaded: libmkl_intel_lp64.dylib
(other compiler errors, like files is not found or Open file failed, please change the path of the files and the code in dgemmx.f, line 49, OPEN(UNIT=1, FILE='/Users/xx/xx/dgemmx.d',STATUS='OLD' so Xcode can find them.)
4) Set Run Environment
Open the Scheme Editor, click the Scheme button in the Project Editor Toolbar and select Edit Scheme, Under the Arguments tab, add DYLD_LIBRARY_PATH as an environment variable.
Set the Value as the full path to the Intel compiler's /lib directory and MKL directory
DYLD_LIBRARY_PATH=/opt/intel/composer_xe_2011_sp1.8.269/compiler/lib:
/opt/intel/composer_xe_2011_sp1.8.269/mkl/lib
Click Run button again, you will get the result in Output box.
Please refer to Intel Compiler User and Reference Guide =>Building Applications with Xcode* IDE"
or "Configuring the Apple Xcode* Developer Software to Link with Intel MKL" section in MKL user guide for more details.
And refer to "Linking Your Application with Intel® MKL" section in the Getting Started document to understand which libraries required by your code.
Operating System:
| Mac OS* |
This article applies to: Intel® C++ Compiler for Mac OS X* Knowledge Base, Intel® Fortran Compiler for Mac OS X* Knowledge Base, Intel® Math Kernel Library Knowledge Base
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (0) 
Trackbacks (0)
Leave a comment 
Ying H (Intel)
|

