# NCHC-CT
This tutorial goes through the usage of NCHC container for writing CUDA programs. The system file will be reset on every launch, but the files located at `/root/` will be saved and therefore you should save all of your code under `/root`. Nonetheless, you should always backup your code such as using git.
Website: https://portal.educloud.nchc.org.tw
## Getting started
Please follow the tutorial prepared by previous TA to start the container and obtain the ssh port for accessing the container: https://hackmd.io/ynRIWGL1Rvytr4Z-uvuRfw
TL;DR:
1. You can select using 1 or 2 GPUs by starting the corrosponding container.

2. Next, navigate to "工作清單". The container should appear in this page.

3. Access your container. We provide 2 options:
- SSH:
Click the "ssh" button. Your browser will open an invalid webpage. The link should be "nodeport.educloud.nchc.org.tw:xxxxxx". You can access the container by
`ssh root@nodeport.educloud.nchc.org.tw -p xxxxxx`, where the password is `student`.

- Visual Studio Code Server:
We provide an easier way to access your container. This is a webpage acting as a normal visual code app. To access the webpage, click "vscode-server" and login with the password `student`.

4. Install the one-time script.
## One-time script
This script prepares the following 2 settings:
1. Generate SSH key
2. Copy SSH key to apollo server. This step will make the judger recognizes your username, instead of `root`.
During running the script, you will be ask to enter your username and password for logging in to Apollo. Since the files under `/root/` will be saved, <span style="color: red;">this script only requires running once</span>.
```bash
bash <(curl -s https://apollo.cs.nthu.edu.tw/ipc23/setup-remote.sh)
```
## Writing your assignment
All sample files are located at `/tmp/dataset-nthu-ipc23/share/`. Once you complete the coding, execute `hw3-judge` to test the correctness. Results will be sent back to https://apollo.cs.nthu.edu.tw/ipc23/scoreboard/hw3. The container provides all tools needed by CUDA labs and assignments:
1. g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
2. CUDA 10.2
3. nvcc
4. nvprof & nsight compute (profiler)
5. GeForce GTX 1080 Ti * 2 (11 GiB VRAM)
PS:
- The default environment variables are configured for bash (~/.bashrc and ~/.bash_profile) only.
- The judger on NCHC will execute your program locally. Please avoid running any task during judgging.
- <span style="color: red;">Mining is prohibited.</span>