The goal of the previous lab was to logon to a CTC windows login node and to copy
the lab files into a subfolder "lab" in your home folder on H:. In this section
we will continue to work on a winlogin node, compiling one of the files copied into
your lab folder. You will need to decide on a programming language, C/C++
or Fortran, and on your compiling environment, Visual Studio or the command line.
We will use the Intel compilers for this lab. For information on using the other compilers,
please refer to the modules listed in the prerequisites.
Prerequisites:
- Read
Compiling and Porting Serial Applications for Windows
- Make sure you have a copy of the source code (karp.c
or karp.f) in your folder: H:\users\your_userid\lab\
. Refer to
the previous lab for instructions for copying files
- Run this and all remaining labs from one of the CTC windows login nodes
Instructions:
Visual Studio, C/C++ or Fortran
- Open Visual Studio. Start | All Programs | Microsoft Visual Studio 2005
| Microsoft Visual Studio 2005. You will get a Start Page where you
can customize some settings. Remember these will only be in effect for the
winlogin node you are currently using.
- In the Visual Studio window, go to File | New | Project.
Select either Visual C++ | Win32 or Intel
Fortran Projects from the Project Types and either Win32 Console
Application (C++) or Console Application (Fortran)
from the Templates window.
- Visual C++
Type the name of the of the project in the
Name textbox (karp) and your projects' home folder in
the Location textbox (H:\Users\your_userid\lab).
Below Location is the Solution Name.
Check the box Create directory for solution. Click the OK
button.
On the next page, select
Application Settings, change the Application
Type to a Console
Application, click on Empty Project under Additional
options and hit the Finish button.
Visual Studio will create a new folder H:\Users\your_userid\lab\karp.
Your solution karp.sln will be located there. The project will be created one folder down, in H:\Users\your_userid\lab\karp\karp.
- Intel C++
By default, all C++ solutions are created in the Visual C++ Project System.
Right click on the project name (karp) and toggle to
Convert to us Intel(R) C++ Project system.
- Intel Fortran
Type the name of the project in the Name
textbox (karp) and your projects' home folder in the Location
textbox (H:\Users\your_userid\lab).
Below Location is the Solution Name. Check
the box Create directory for solution. Click the OK
button.
On the next page, select
Application Settings, choose Empty Project under Console application type and hit the Finish button.
Visual Studio will create a new folder H:\Users\your_userid\lab\karp.
Your solution karp.sln will be in H:\Users\your_userid\lab\karp.
The project will be created one folder down, in H:\Users\your_userid\lab\karp\karp.
- Add the source file in one of two ways:
- Go to Project | Add Existing Item
- Right click on Source Files under the Project
in the Solution Explorer pane, which brings up Add |
Existing Item.
Select the source file (karp.c or karp.f).
You will find it two levels up at H:\Users\your_userid\lab\. You can see
the contents of the source files (karp.c or karp.f)
by double clicking on it in the Solution Explorer pane.
- There are multiple ways to build an executable:
- from the main menu choose Build | Build Project Name
- add the Build Toolbar from View | Toolbars |
Build and click on the Build icon
- right-click on the name of the project in the Solution Explorer
panel and choose the Build option
By default any of the above actions will create a debug version of the code.
If you want the release version, toggle the
Debug/Release pane.
- Save your solution file File | Save All. Close Visual Studio.
Command Line:
- Open a command prompt window from a winlogin node:
Start | All Programs | Accessories | Command Prompt
- Move to the directory where source files are located:
cd lab
- Check that you are in the lab subfolder, and that the files are there:
dir
For Intel C/C++:
- setup_intelc32
- icl karp.c
For Fortran :
- setup_intelf32
- ifort karp.f
Results:
The executable created in Visual Studio is located at:
C/C++: H:\Users\your_userid\lab\karp\Debug\karp.exe
Fortran: H:\Users\your_userid\lab\karp\karp\Debug\karp.exe
The executable created at the command prompt is located at:
H:\Users\your_userid\lab\karp.exe