setup CUDA development environment on windows11

install CUDA Toolkit first, from CUDA Toolkit Archive to choose CUDA Toolkit to download. we choose the version: CUDA Toolkit 12.4.1. 1 2 3 4 5 6 ❯ nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2024 NVIDIA Corporation Built on Thu_Mar_28_02:30:10_Pacific_Daylight_Time_2024 Cuda compilation tools, release 12.4, V12.4.131 Build cuda_12.4.r12.4/compiler.34097967_0 install cuDNN from cuDNN Archive to choose cuDNN to download. we choose the version: cuDNN 9.1.0. install pytorch Get pip cmd from Installing previous versions of PyTorch we choose torch==2.4.0: 1 pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu124 Check GPU(cuda): 1 2 3 4 >>> import torch >>> torch.cuda.is_available() True >>>

August 30, 2024

setup uv for python development

install 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # On macOS and Linux curl -LsSf https://astral.sh/uv/install.sh | sh # On Windows powershell -c "irm https://astral.sh/uv/install.ps1 | iex" powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" scoop install uv # With pip (if you must, not the preferred way though) pip install uv # on macOS brew install uv eval "$(uv generate-shell-completion zsh)" set UV_CACHE_DIR By default, the cache is stored in $XDG_CACHE_HOME/uv or $HOME/.cache/uv on Unix and %LOCALAPPDATA%\uv\cache on Windows. ...

April 7, 2024

setup python development on windows11

install scoop 1 2 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression update scoop 1 scoop update install pyenv 1 scoop install pyenv setup python install python with pyenv 1 2 3 pyenv install 3.10.0 pyenv local 3.10.0 install poetry 1 pip install poetry configure poetry in: %APPDATA%\pypoetry 1 2 3 4 [virtualenvs] in-project = true virtualenvs.prefer-active-python = true prefer-active-python = true install jupyter 1 pip install jupyterlab install ipython 1 pip install ipykernel

April 5, 2024

A Step-by-Step Guide to Setting Up Solana on Ubuntu

Install Rust 1 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y install solana CLI 1 sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)" 1 solana --version Install Anchor CLI 1 2 3 sudo apt install build-essential cargo install --git https://github.com/coral-xyz/anchor avm --force 1 2 3 4 5 6 7 avm install latest avm use latest anchor --version install nvm and node 1 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash 1 2 export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm 1 2 nvm install node npm install --global yarn

April 2, 2024

upgrade ubuntu in WSL

show lsb-release before upgrade 1 2 3 4 5 6 cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS" prepare open file with command is as follows: 1 sudo nano /etc/update-manager/release-upgrades set Prompt=lts is as follows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # Default behavior for the release upgrader. [DEFAULT] # Default prompting and upgrade behavior, valid options: # # never - Never check for, or allow upgrading to, a new release. # normal - Check to see if a new release is available. If more than one new # release is found, the release upgrader will attempt to upgrade to # the supported release that immediately succeeds the # currently-running release. # lts - Check to see if a new LTS release is available. The upgrader # will attempt to upgrade to the first LTS release available after # the currently-running one. Note that if this option is used and # the currently-running release is not itself an LTS release the # upgrader will assume prompt was meant to be normal. Prompt=lts CTRL+S to save, then CTRL+X to exit. ...

April 2, 2024

WSL command: export, import

list before export 1 wsl -l -v 1 2 3 PS C:\Users\mysel> wsl -l -v NAME STATE VERSION * Ubuntu-22.04 Stopped 2 delete cache to reduce disk cost 1 rm -rf /home/ia/.cache/* export 1 wsl.exe --export Ubuntu-22.04 I:\wslback\Ubuntu-22.04.bak import 1 wsl.exe --import U22 i:\wsl\u22\ d:\wslback\Ubuntu-22.04.bak run 1 wsl.exe -d U22 list after import 1 wsl -l -v 1 2 3 4 PS C:\Users\mysel> wsl -l -v NAME STATE VERSION * Ubuntu-22.04 Stopped 2 U22 Running 2 show location 1 Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath} | Select-Object DistributionName,BasePath access from explorer 1 \\wsl.localhost\U22 add to Windows Terminal 1 2 3 4 5 6 7 8 { "commandline": "wsl.exe -d U22", "guid": "{e5a83caa-4c73-52b3-ae6b-bc438d721ef9}", "hidden": false, "name": "U22", "source": "CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc", "startingDirectory": "~" },

April 1, 2024

setup CUDA development environment in WSL2

Install the GCC compiler 1 sudo apt install gcc --fix-missing Install Nvidia CUDA toolkit 1 sudo apt install nvidia-cuda-toolkit check the Driver and CUDA versions 1 2 nvidia-smi nvcc -V Install Python with Mamba 1 2 wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh bash Miniforge3-Linux-x86_64.sh 1 2 3 mamba create -n mycuda jupyterlab -c conda-forge mamba activate mycuda jupyter lab Testing Cuda Search nvidia control panel, and select “Allow access to GPU performance counters to all users” ...

March 30, 2024

setup python development environment in WSL

requirement 1 2 3 4 5 6 7 8 sudo apt update sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev sudo apt-get install lzma sudo apt-get install liblzma-dev sudo apt-get install libbz2-dev sudo apt-get install python3-tk pyenv what is pyenv pyenv is for a Python version management + virtual environment tool. install pyenv 1 curl https://pyenv.run | bash pyenv 1 2 3 echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo 'eval "$(pyenv init -)"' >> ~/.bashrc 1 source ~/.bashrc usage List all available pyenv commands 1 pyenv commands List all available Python versions 1 pyenv install -l Installing specific Python versions 1 pyenv install 3.12.0 Uninstall a specific python version 1 pyenv uninstall 3.12.0 Show all Python versions 1 pyenv versions Setting the global Python version 1 pyenv global 3.12.0 Display the currently active Python version 1 pyenv version Display the full path to the Python version 1 pyenv which python Set a shell-specific Python version 1 pyenv shell 3.12.0 Unsets the shell version 1 pyenv shell --unset Set a local Python version 1 pyenv local 3.11.5 Unset the local Python version 1 pyenv local --unset install pyenv-virtualenv install pyenv-virtualenv 1 2 3 $ git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv $ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc $ source ~/.bashrc pyenv-virtualenv ...

March 27, 2024

WSL-network

static ip address 1 2 3 4 5 6 7 8 9 10 netsh int ipv4 show interfaces Idx Met MTU 状态 名称 --- ---------- ---------- ------------ --------------------------- 1 75 4294967295 connected Loopback Pseudo-Interface 1 10 50 1500 disconnected WLAN 3 35 1500 connected 以太网 14 25 1500 disconnected 本地连接* 1 12 25 1500 disconnected 本地连接* 2 44 15 1500 connected vEthernet (WSL (Hyper-V firewall)) setup static ip address: ...

March 26, 2024

windows terminal

install On windows11, windows terminal has installed as default. If not, Please install windows terminal from Microsoft Store. update PowerShell Get PowerShell Version: 1 2 3 4 5 6 7 8 9 10 11 12 13 $PSVersionTable Name Value ---- ----- PSVersion 5.1.22621.2506 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.22621.2506 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 update PowerShell: ...

March 25, 2024