Prerequisites
You should review the modules on
Getting Started and CCS
before starting this lab.
Overview
The goal of this lab exercise is to successfully compile and link a serial code
and optionally to run it on the velocity cluster. Please refer to the sections on
Compiler Choice,
New Projects and
Console Projects in
this module for useful information to complete this lab.
Exercise
- This exercise involves using Microsoft Visual Studio NET 2005 as a graphic interface.
- Move to your home directory on H: and create a new folder for this exercise, eg
MyVWProjects.
- Copy hello.c and/or hello.f
from H:\VWLabs\Writing1 into this local folder.
- Start Visual Studio .Net.
- Create a new project in this folder.
- Add hello.c or hello.f file to the project.
- Build your executable.
- Run it using Visual Studio .NET Environment (if you are not on a winlogin node).
- Run it from a command window (if you are not on a login node).
- Optional: Run it as a batch job.
Solution
- Do this exercise in one of the following places:
- A winlogin node using
Remote Desktop Connection, or
- Your own desktop, if you have Microsoft Visual Studio .NET 2005 installed and you
have H: mapped, or
- The Collaboratory
- Navigate to your home directory on H: (H:\Users\YourUserName) and
create a new folder MyVWProjects using menu File | New | Folder
- Navigate to directory H:\VWLabs\Writing1 and drag either
hello.c and/or hello.f into your new folder MyVWProjects.
- Open Visual Studio .Net 2005: 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 login node you are currently using.
- In the Visual Studio window, go to File | New | Project.
Select either Visual C++ | Win32 or Intel (R) Fortran Projects
from the the Project Types and either a Win32 Console Application
(C++) or a Console Application (Fortran) from the Templates window.
- Visual C++ -- Type the name of the of the project in the
Name textbox HelloC and your projects' home folder in
the Location textbox (H:\Users\YourUserName\MyVWProjects).
Do Not click on "Create directory for solution". Click on the OK button. On the next page,
click on Application Settings and change the application to a Console Application.
Click on Empty Project under additional options and hit
the Finish button.
- Intel Fortran -- Type the name of the of the project in the
Name textbox HelloF and your projects' home folder in
the Location textbox (H:\Users\YourUserName\MyVWProjects).
Do Not click on "Create directory for solution". Click on the OK button.
On the next page,
click on Application Settings, choose Empty Project under
Console Application Type and hit the Finish button.
- Add the source file. There are two ways to do this. Go to Project | Add Existing Item
or right click on
Source Files under the Project in the Solution Explorer
pane, which brings up Add | Add Existing Item. Select
the file (hello.c or hello.f) depending on the
language of the project (you will find it one level up from the specific project
folder at H:\Users\YourUserName\MyVWProjects).
-
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 Solution option
All the above actions will create a debug version of the same code (helloc.exe
or hellof.exe) by default. If you want the release version, you
need to toggle the Debug/Release pane.
-
From the main menu click Debug | Start Without Debugging (Ctrl+F5)
or Debug | Start (F5).
-
Open a command window (Start | All Programs | Accessories | Command Prompt)
and navigate to the directory where the executable is
(H:\Users\YourUserName\MyVWProjects\Debug).
Type the name you gave to the project (HelloC or HelloF). The executable
has the same name as its project unless you explicitly rename it.
-
Adapt the batch script you created in the
lab for CCS. If you copy the executable
you just created to the same directory you used for the CCS lab, then the only thing
you have to change in your batch script is the name of the executable.
Remember:
Programs are not to be run on the login nodes: ctclogina or ctcloginb.
Cleanup
Close Visual Studio .NET 2005 and delete your local folder created for this exercise
H:\Users\YourUserName\MyVWProjects.