🏛 University project for the "High Performance Computing" course by Sandro Luigi Fiore
You'll need a VPN to connect to Trento's VPN to access hpc2.unitn.it
-
Open the GlobalProtect VPN client by running
gpclient
(be sure to follow the setup instructions from the official repo) -
Enter as portal address
vpn.icts.unitn.it
-
The username is your unitn email without the "studenti" subdomain -e.g.,
mario.rossi@unitn.it
- -
The password is your unitn password
-
Now you should be able to successfully ping
hpc2.unitn.it
A text file where the first row contains the number of points (unsigned int32).
Each subsequent row contains two integers x and y (int32) in the format x<space>y
,
representing the coordinates of a point.
Example of a file with points [(1, 2), (-3, 89), (42, 137)]
:
3
1 2
-3 89
42 137
Found the closest pair in 100 milliseconds.
The closest pair of points is:
(-3, 89) and (42, 137)
Their distance is:
65.79513
In order to run this program on the cluster, just push here on Github on the main branch. The CI will:
-
build the code
-
copy it in the cluster
-
start the job
-
notify us on telegram once it is finished
Note that for this job to run successfully, the following secrets have to be present in the github repo:
BOT_TOKEN
: The token of the telegram bot used for notifying that the job completedTELEGRAM_CHAT_ID
: The ID of the chat where the bot sends the updatesUNITN_PASSWORD
: Unitn emailUNITN_USERNAME
: Unitn password
-
Ensure you can ping the cluster (
hpc2.unitn.it
). Otherwise you may need to connect to the VPN. -
Open a ssh connection to the cluster. You can do so by running
ssh hpc2.unitn.it -l mario.rossi@unitn.it
. Then note the location of your home directory on the cluster, given by the output of thepwd
command (should be/home/mario.rossi
). -
Copy the code to the cluster by either
- Running on your machine
scp -r -o "user=mario.rossi@unitn.it" ./path/to/the/code/on/your/machine hpc2.unitn.it:/home/mario.rossi/HPC_course
- Running on the cluster -in the target directory-
git clone https://github.com/civts/parallel-closest-pair
- Running on your machine
-
Compile the code by running (on the cluster)
module load mpich-3.2
, thenmpicc -o parallel_closest_points main.c -lm
Start a run of the program (job) by running on the cluster `qsub
With Nix and direnv you can get exactly our setup by running this script:
git clone https://github.com/civts/parallel-closest-pair #Downloads this repository
cd parallel-closest-pair
direnv allow #Fetches all the dependencies (and VSCodium)
codium . #Launches VSCodium
Then open the file you want to debug and press F5
to launch it.
-
Install the following packets:
-
If you are using VSCode/VSCodium as editor, we recommend you have the following extensions installed:
- vadimcn.vscode-lldb (we used version 1.7.4)
- xaver.clang-format (we used version 1.9.0)
- ms-vscode.cpptools (we used version 1.11.0)
- franneck94.c-cpp-runner (we used version 3.0.0)
-
Clone this repo, open it in the editor
-
Open the file you want to debug and press
F5
to launch it.
If it does not find gtest/gtest.h
, run ./scripts/test.sh
, ensure that the test/build
is shown in the file explorer on the side (otherwise modify files.exclude
in settings.json
to not exclude it). Then restart VS Code.