Install Conda
Since I am a mac user and I want to leverage the Apple Silicon CPU architecture, I installed Miniforge.
During installation, I chose not to have conda
to control my shell environment, and therefore after installation, I need to run the following command to activate the base environment.
source ~/miniforge3/bin/activate
Windows Users
For windows users, use this link.
After installation, search in the start menu with Anacoda Prompt
.
You should be able to see a special cmd prompt with the Anaconda icon in the bottom right corner.
Create/Activate Environment
There’s a YAML definiton of the environment file. We can run the following command to create a new environment from it:
conda env create --file environment.yml
You can run the following command to list the available environments:
conda env list
Here’s the sample output. Note that the one with *
in front of it is the active environment.
# conda environments:
#
base * /Users/huanghuijing/miniforge3
XCS330 /Users/huanghuijing/miniforge3/envs/XCS330
To activate the newly created environment, run:
conda activate <your-env-name>
After activation, we will notice the change of the environment:
(XCS330) huanghuijing@huangs-MacBook-Air
In this new environment, we can project our base
environment from breaking.
Jupyter Notebook
In the active environment, run:
# install ipykernel
conda install -c anaconda ipykernel
# install the new kernel
ipython kernal install --user --name=<your-env-name>
# luanch the notebook
jupyter notebook
Read more about kernels in Jupyter notebook.
VSCode Virtual Environment
To configure VSCode to use Anaconda virtual environment:
- shift + cmd + p
- search
Select Interpreter
- in the dropdown list, select the target environment
See more here.
If your IDE is not intelligent enough to select the XCS330 virtual environment, run conda env list
to get the path, and use that location.
For instance, in Windows:
conda env list
# conda environments:
#
base C:\Users\huijinghuang\AppData\Local\miniconda3
XCS330 * C:\Users\huijinghuang\AppData\Local\miniconda3\envs\XCS330
Azure Lab
Here’s a private link to the Guide.
Here’s the link to the Azure Lab: https://labs.azure.com/register/jz00ageau
Once you login with your student account, you can start the VM and then copy paste the ssh command in your terminal.
ssh -p 5020 scpdxcs@lab-xxxx.eastus.cloudapp.azure.com
Make sure GPU is available:
nvidia-smi
List all the conda environment and use the correct one:
# List pre-installed environments
conda env list
# Activate the XCS330 environment with CUDA
conda activate /anaconda/envs/XCS330_CUDA
To manage process on a VM wisely, use TMUX (Terminal Multiplexer
):
tmux
Set up github in the lab, and then run git clone to check out the source code.
Transfer Data
Use the port
number from your connection string.
Upload to the lab machine (run the command in local terminal):
scp -r -P 5020 data scpdxcs@lab-xxx.eastus.cloudapp.azure.com:~
Download to the local machine (run the command in the vm):
scp -r -P 5020 scpdxcs@lab-xxx.eastus.cloudapp.azure.com:/home/scpdxcs/XCS330-PS4/src/submission/results .