1.1.1. Exercise no. 2.

2. Fortran example (CPO handling)

(approx. 30 min)

The knowledge gained

After this exercise you will:

  • know how to prepare Fortran codes that use UAL
  • know how to prepare Fortran based library that uses UAL
  • know how set up Makefile
  • know how start and configure FC2K tool

In this exercise you will execute simple Fortran code that uses UAL. Code will be incorporated into Kepler. In order to do this follow the instructions:

2.1. 1. Get familiar with codes that will be incorporated into Kepler

Go to Code Camp related materials within your home directory

shell> cd $TUTORIAL_DIR/FC2K/equilibrium2distsource/

You can find there various files. Pay particular attention to following ones:

  • equilibrium2distsource.f90 - Fortran source code that will be executed from Kepler - this code uses UAL
  • Makefile - makefile that allows to build library file
  • cposlice2cposlicef_fc2k.xml - parameters for FC2K application (NOTE! this file contains my own settings, we will modify them during tutorial)
  • cposlice2cposlicef_kepler.xml - example workflow

2.2. 2. Build the code

A Fortran example could be built by issuing

shell> make clean -f make_ifort
shell> make -f make_ifort

Codes are ready to be used within FC2K

2.3. 3. Prepare environment for FC2K

Make sure that all required system settings are correctly set

shell> source $ITMSCRIPTDIR/ITMv1 kepler test 4.10b > /dev/null

2.4. 4. Start FC2K application

This is as simple as typing fc2k from terminal

shell> fc2k

After a while, you should see FC2K's main window

 

Default settings
Note, that your settings will be slightly different. Your Kepler location should point to a valid path for your account.

 

2.5. 5. Open project cposlice2cposlicef_fc2k

  1. Choose File -> Open
  2. Navigate to $TUTORIAL_DIR/FC2K/equilibrium2distsource/.
  3. Open file cposlice2cposlicef_fc2k.xml.
  4. You should see new project loaded into FC2K.

    Fig. 1. FC2K main window: project cposlice2cposlicef_fc2k loaded

2.6. 6.Project settings

Please take a look at the project settings.

Fig. 2. FC2K arguments tab

Subroutine arguments:

  • one input argument - CPO array
  • one output argument - CPO array
Fig 3. Library delivering user code

After loading parameters you can notice that library location points to location within your itmwork directory ($ITMWORK).

2.7. 7. After all the settings are correct, you can generate actor

Simply press "Generate" button and wait till FC2K finishes the generation.

 

Generating an actor for the second time
This tutorial assumes that Gateway accounts will be used for starting up Kepler application.
If you are not familiar with NX setup for the Gateway, take a look at following location NX setup

 

2.8. 8. Confirm Kepler compilation

After actor is generated, FC2K offers to compile Kepler application. Make sure to compile it by pressing "Yes".

Fig 4. FC2K: successful compilation

2.9. 9. You can now start Kepler and use generated actor

Open new terminal window and make sure that all environment settings are correctly set and execute Kepler.

shell> source $ITMSCRIPTDIR/ITMv1 kepler test 4.10b > /dev/null
shell> kepler.sh

After Kepler is started, open example workflow from the following location

shell> $TUTORIAL_DIR/FC2K/equilibrium2distsource/cposlice2cposlicef_kepler.xml

You should see similar workflow on screen.

Fig. 5. Kepler worflow loaded

2.10. 10. Launch the workflow

You can start the workflow execution, by pressing "Play" button

Fig. 6. Workflow launch button

After workflow finishes it's execution, you should see result similar to one below:

Fig. 7. Outcome of the workflow execution

3. Exercise no. 2 finishes here.

 
  • No labels