Skip to content

Project 2026

Download the handout of the project

Compile and run the serial code

To compile the serial code, load the Info0939Tools module on NIC5 and run the get_info0939_project command to get a copy of the code.

module load Info0939Tools
get_info0939_project
cd project_info0939/

To produce an executable, run the following compilation command:

gcc -o nbody -O3 -ffast-math nbody.c -lm

This will generate an executable named nbody. You can test the executable by running the first predefined problem:

./nbody 1

Here the serial code is run on the login node of NIC5. This is fine for such a small example. However it is not considered good practice to run your code on the login node(s) of HPC clusters (see Rule #3 of the fair use of CÉCI clusters). In general, applications should run on a compute node. See this section of the lecture notes for a detailed description on how to launch the serial code on a compute node.

Visualize the results

The code produces a series of VTK Image files (.vti) as well as a manifest in the ParaView Data file format (.pvd). To visualize these file you can use ParaView. Paraview is available for all major operating systems:

Basic visualization

Before starting the visualization, you need to copy the output files to your computer. How to do that is described on this page. Note that it is easier to create a Zip file before copying the outputs. The creation of a Zip file is described here.

Open ParaView and navigate to File Open and select the pvd file you want to open. For the simple example, the file name is bodies.pvd. Next click Apply button.

Next, click the Play button to perform the visualization.

Export the visualization as a movie

To export your visualization pipeline as a movie File Save Animation...

Choose the name under which you wish to save the animation. For example, you can use nbody as the name.

Click on the OK button which will bring you to the next dialog box where you can select the option for the movie. Select the Image Resolution you want to use. You can also change the Frame Rate to a higher value than the default value of 1. For example, you can use 10. After you click the Ok button, a dialog box will be displayed to indicate the progress of the export.