Compare commits
5 Commits
c42da6ca58
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
939a511625 | ||
|
|
2bf47dc0c0 | ||
|
|
5871c79501 | ||
|
|
f7217a93bb | ||
|
|
5e2d3dd6b7 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,4 @@
|
|||||||
src/**/*.ini
|
src/**/*.ini
|
||||||
pypho
|
|
||||||
|
|
||||||
# VSCode
|
# VSCode
|
||||||
.vscode
|
.vscode
|
||||||
|
|||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "pypho"]
|
||||||
|
path = pypho
|
||||||
|
url = git@gitlab.lrz.de:000000003B9B3E61/pypho.git
|
||||||
13
README.md
13
README.md
@@ -13,10 +13,19 @@ Full license text in LICENSE file
|
|||||||
|
|
||||||
# optical-regeneration
|
# optical-regeneration
|
||||||
|
|
||||||
This repo has about 7.5GB of datasets in it. The download will take a while.
|
## Notes on cloning:
|
||||||
|
|
||||||
|
- `pypho` is added as a submodule -> `--recurse-submodules`
|
||||||
|
- This repo has about 7.5GB of datasets in it. The `git lfs fetch` step will take a while.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://git.suuppl.dev/seppl/optical-regeneration.git
|
apt install git-lfs
|
||||||
|
# only necessary once per user account
|
||||||
|
git lfs install
|
||||||
|
|
||||||
|
git clone --recurse-submodules https://git.suuppl.dev/seppl/optical-regeneration.git && cd optical-regeneration
|
||||||
|
git lfs fetch
|
||||||
|
git lfs checkout
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|||||||
74
notes/cuda-12-4-install.md
Normal file
74
notes/cuda-12-4-install.md
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# CUDA 12.4 Install
|
||||||
|
|
||||||
|
> https://unknowndba.blogspot.com/2024/04/cuda-getting-started-on-wsl.html (@\_freddenis\_, 2024)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# get md5sums
|
||||||
|
wget https://developer.download.nvidia.com/compute/cuda/12.4.1/docs/sidebar/md5sum.txt
|
||||||
|
#
|
||||||
|
# setup cuda apt repo
|
||||||
|
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
|
||||||
|
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
|
||||||
|
#
|
||||||
|
# download installer and check md5sum
|
||||||
|
wget https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda-repo-wsl-ubuntu-12-4-local_12.4.1-1_amd64.deb
|
||||||
|
md5sum --check --ignore-missing md5sum.txt
|
||||||
|
#
|
||||||
|
# try to install cuda (this will fail, but it puts the keyring file in the correct spot)
|
||||||
|
sudo dpkg -i cuda-repo-wsl-ubuntu-12-4-local_12.4.1-1_amd64.deb
|
||||||
|
#
|
||||||
|
# copy cuda gpg keyring to keyrings
|
||||||
|
sudo cp /var/cuda-repo-wsl-ubuntu-12-4-local/cuda-*-keyring.gpg /usr/share/keyrings/
|
||||||
|
#
|
||||||
|
# install cuda (this time for real)
|
||||||
|
sudo dpkg -i cuda-repo-wsl-ubuntu-12-4-local_12.4.1-1_amd64.deb
|
||||||
|
#
|
||||||
|
# install cuda-toolkit
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install cuda-toolkit-12-4
|
||||||
|
#
|
||||||
|
# setup path
|
||||||
|
# sudo apt install plocate
|
||||||
|
locate nvcc
|
||||||
|
# -> returns /usr/local/cuda-12.4
|
||||||
|
# add these lines to your .profile (.zshrc, ...)
|
||||||
|
#
|
||||||
|
# export PATH="/usr/local/cuda-12.4/bin:$PATH"
|
||||||
|
# export LD_LIBRARY_PATH="/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH"
|
||||||
|
#
|
||||||
|
# after source-ing, check version of nvcc
|
||||||
|
nvcc -V
|
||||||
|
```
|
||||||
|
|
||||||
|
## check cuda installation with cuda samples
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/NVIDIA/cuda-samples
|
||||||
|
cd cuda-samples/Samples/1_Utilities/deviceQuery
|
||||||
|
make
|
||||||
|
./devicequery
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### if the cuda-toolkit install fails with unmet dependencies
|
||||||
|
|
||||||
|
>https://askubuntu.com/a/1493087 (jspinella, 2023, CC BY-SA 4.0)
|
||||||
|
|
||||||
|
1. Open the *new* file for storing the sources list
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nano /etc/apt/sources.list.d/ubuntu.sources
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Paste in the following at the end of the file:
|
||||||
|
|
||||||
|
```raw
|
||||||
|
Types: deb
|
||||||
|
URIs: http://archive.ubuntu.com/ubuntu/
|
||||||
|
Suites: lunar
|
||||||
|
Components: universe
|
||||||
|
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Save the file and run `sudo apt update` - now the install command for CUDA should work.
|
||||||
|
|
||||||
4
notes/links.md
Normal file
4
notes/links.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# useful links
|
||||||
|
|
||||||
|
- (Optuna)[https://optuna.org] Hyperparameter optimization framework
|
||||||
|
`pip install optuna`
|
||||||
46
notes/pyenv-install.md
Normal file
46
notes/pyenv-install.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# pyenv install
|
||||||
|
|
||||||
|
## install
|
||||||
|
|
||||||
|
nice to have:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install python-is-python3
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl https://pyenv.run | bash
|
||||||
|
```
|
||||||
|
|
||||||
|
## setup zsh
|
||||||
|
|
||||||
|
add the following to `.zshrc`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PYENV_ROOT="$HOME/.pyenv"
|
||||||
|
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||||
|
eval "$(pyenv init -)"
|
||||||
|
```
|
||||||
|
|
||||||
|
## pyenv install
|
||||||
|
|
||||||
|
prerequisites:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install build-essential libssl-dev zlib1g-dev \
|
||||||
|
libbz2-dev libreadline-dev libsqlite3-dev curl git \
|
||||||
|
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
|
||||||
|
libffi-dev liblzma-dev python3-pip
|
||||||
|
```
|
||||||
|
|
||||||
|
install:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# using python 3.12.7 as an example
|
||||||
|
pyenv install 3.12.7
|
||||||
|
|
||||||
|
# optional
|
||||||
|
pyenv global 3.12.7
|
||||||
|
pyenv versions
|
||||||
|
```
|
||||||
25
notes/pytorch-install.md
Normal file
25
notes/pytorch-install.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# pytorch install
|
||||||
|
|
||||||
|
## create venv
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m venv ./.venv
|
||||||
|
source ./.venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
## install pytorch
|
||||||
|
> https://pytorch.org/get-started/locally/
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install torch torchvision torchaudio
|
||||||
|
```
|
||||||
|
|
||||||
|
## test pytorch install
|
||||||
|
|
||||||
|
```python
|
||||||
|
import torch
|
||||||
|
x = torch.rand(5, 3)
|
||||||
|
print(x)
|
||||||
|
|
||||||
|
torch.cuda.is_available()
|
||||||
|
```
|
||||||
1
pypho
Submodule
1
pypho
Submodule
Submodule pypho added at 08d6dadf20
@@ -3,7 +3,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
# hack to add the parent directory to the path -> pypho doesn't have to be installed as package
|
# hack to add the parent directory to the path -> pypho doesn't have to be installed as package
|
||||||
parent_dir = Path(__file__).parent
|
parent_dir = Path(__file__).parent
|
||||||
while not (parent_dir / "pypho").exists() and parent_dir != Path("/"):
|
while not (parent_dir / "pypho" / "pypho").exists() and parent_dir != Path("/"):
|
||||||
parent_dir = parent_dir.parent
|
parent_dir = parent_dir.parent
|
||||||
print(f"Adding '{parent_dir}' to 'sys.path' to enable import of '{parent_dir / 'pypho'}'")
|
print(f"Adding '{parent_dir / "pypho"}' to 'sys.path' to enable import of '{parent_dir / 'pypho' / 'pypho'}'")
|
||||||
sys.path.append(str(parent_dir))
|
sys.path.append(str(parent_dir / "pypho"))
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ def length_loop(config, lengths, incremental=False):
|
|||||||
in_out_eyes(cfiber, cdata)
|
in_out_eyes(cfiber, cdata)
|
||||||
|
|
||||||
|
|
||||||
def single_run_with_plot(config):
|
def single_run_with_plot(config, save=True):
|
||||||
cfiber, cdata, noise, edfa = initialize_fiber_and_data(config)
|
cfiber, cdata, noise, edfa = initialize_fiber_and_data(config)
|
||||||
|
|
||||||
mean_power_in = np.sum(pypho.functions.getpower_W(cdata.E_in))
|
mean_power_in = np.sum(pypho.functions.getpower_W(cdata.E_in))
|
||||||
@@ -405,7 +405,8 @@ def single_run_with_plot(config):
|
|||||||
E_tmp = [{'E': cdata.E_out, 'noise': noise*(-cfiber.params.l*cfiber.params.alpha)}]
|
E_tmp = [{'E': cdata.E_out, 'noise': noise*(-cfiber.params.l*cfiber.params.alpha)}]
|
||||||
E_tmp = edfa(E=E_tmp)
|
E_tmp = edfa(E=E_tmp)
|
||||||
cdata.E_out = E_tmp[0]['E']
|
cdata.E_out = E_tmp[0]['E']
|
||||||
save_data(cdata, config)
|
if save:
|
||||||
|
save_data(cdata, config)
|
||||||
|
|
||||||
in_out_eyes(cfiber, cdata)
|
in_out_eyes(cfiber, cdata)
|
||||||
|
|
||||||
@@ -509,7 +510,7 @@ if __name__ == "__main__":
|
|||||||
]
|
]
|
||||||
lengths.append(max(length_ranges)*10)
|
lengths.append(max(length_ranges)*10)
|
||||||
|
|
||||||
length_loop(config, lengths)
|
# length_loop(config, lengths)
|
||||||
|
|
||||||
# single_run_with_plot(config)
|
single_run_with_plot(config, save=False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user