Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Exercise no. 3

Embedding simple C++ code within Kepler (no CPOs)

(approx. 30 min)


Info
titleThe knowledge gained

After this exercise you will:

  • know how to prepare C++ codes for FC2K
  • know how to prepare C++ library
  • know how set up Makefile
  • know how start and configure FC2K tool

 

In this exercise you will execute simple C++ code within Kepler. In order to do this follow the instructions:

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

Go to Code Camp related materials within your home directory

Code Block
cd $TUTORIAL_DIR/FC2K/simplecppactor_nocpo

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

  • simplecppactornocpo.cpp - C++ source code that will be executed from Kepler
  • Makefile - makefile that allows to build library file
  • simplecppactor_nocpo_fc2k.xml - parameters for FC2K application (NOTE! this file contains my own settings, we will modify them during tutorial)
  • simplecppactor_nocpo_workflow.xml - example workflow

2. Build the code by issuing

Code Block
shell> make clean
shell> make

Codes are ready to be used within FC2K

3. Prepare environment for FC2K

Make sure that all required system settings are correctly set

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

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

 

Image Removed
Info

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

 

5. Open project simplecppactor_nocpo

  1. Choose File -> Open
  2. Navigate to $TUTORIAL_DIR/FC2K/simplecppactor_nocpo
  3. Open file simplecppactor_nocpo_fc2k.xml.
  4. You should see new project loaded into FC2K.
Image Added
Fig. 1. FC2K main window: project simplecppactor_nocpo loaded

6. Project settings

Please take a look at the project settings.

Image Added
Fig. 2. FC2K arguments tab

Function arguments:

  • one input argument - double
  • one output argument - double
Image Added
Fig. 3. FC2K source tab

After loading parameters you can notice that library location points to location within your $TUTORIAL_DIR directory.

7. Actor generation

After all the settings are correct, you can generate actor

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

 

Image RemovedGenerating 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

 

9.

8. Confirm Kepler compilation

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

Image Added
Fig 4. FC2K - successful generation

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

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

$TUTORIAL_DIR/FC2K/simplecppactor_nocpo/simplecppactor_nocpo_workflow.xml

You should see similar workflow on screen.

Image Added
Fig. 5. Kepler worflow loaded

10. Launch the workflow

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

Image Added
Fig. 6. Workflow launch button

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

Image Added
Fig. 7. Outcome of the workflow execution

Exercise no. 3 finishes here.