Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
prog:wsl [2021/07/14 18:29] – [Paquets] : ajout de --keep-going root | prog:wsl [2024/10/19 00:00] (Version actuelle) – backtrace -> backtrack root |
---|
=====Premiers pas===== | =====Installation===== |
| |
====Installation==== | |
| |
* Sous PowerShell (Admin) : | * Sous PowerShell (Admin) : |
| |
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux | Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux |
| Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform |
| |
* Sous PowerShell (Admin) : | * Définir une adresse IP |
| |
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform | Cette étape ne doit être faite que si ''WSL'' définit une adresse IP non compatible avec le réseau Ethernet. |
| |
| Pour connaître l'adresse IP depuis Linux, lancer ''ip a''. Côté Windows, lancer ''ipconfig''. |
| |
| Il n'est pas possible de définir une adresse IP statique sur ''WSL''. Mais il est possible d'en ajouter une. |
| |
| Commencer par redémarrer l'ordinateur pour que l'interface réseau ''vEthernet (WSL)'' ne soit pas définie. Exécuter en ligne de commande avec droits administrateur : |
| |
| <code bash> |
| wsl -d "Ubuntu-22.04" -u root ip addr add 172.20.0.176/16 dev eth0 label eth0:1 |
| netsh interface ip add address "vEthernet (WSL)" 172.20.0.177 255.255.0.0 |
| </code> |
| |
| [[https://github.com/microsoft/WSL/issues/4210#issuecomment-648570493|WSL2 Set static ip?]] {{ :prog:wsl:wsl2_set_static_ip_issue_4210_microsoft_wsl_14_10_2022_10_05_02_.html |Archive du 21/06/2019 le 14/10/2022}} |
| |
| =====Distribution Ubuntu===== |
| |
* Installer la distribution Linux le Windows Store : https://docs.microsoft.com/en-us/windows/wsl/install-manual | * Installer la distribution Linux le Windows Store : https://docs.microsoft.com/en-us/windows/wsl/install-manual |
| |
<code bash> | <code bash> |
apt-get update | apt update |
| apt upgrade |
</code> | </code> |
| |
| |
| =====Configuration spécial WSL===== |
| |
| * OpenGL |
| |
| Pour avoir le support GPU / OpenGL, il suffit d'installer les derniers drivers NVIDIA récents. |
| |
| * OpenCL |
| |
| OpenCL n'est supporté pour le moment que par Intel. |
| |
| Il faut installer les paquets ''ocl-icd-libopencl1'' et ''ocl-icd-opencl-dev'' ainsi que les [[https://github.com/intel/compute-runtime/|drivers spécifiques à Intel]]. Il ne faut pas que ''intel-opencl-icd'' soit installé depuis les dépôts Ubuntu. |
| |
| Si l'installation des drivers spécifiques n'est pas fait, le programme risque de planter au premier appel de la fonction ''cl*''. |
| |
| <code bash> |
| apt install ocl-icd-libopencl1 ocl-icd-opencl-dev |
| cd /tmp/neo |
| wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.12260.1/intel-igc-core_1.0.12260.1_amd64.deb |
| wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.12260.1/intel-igc-opencl_1.0.12260.1_amd64.deb |
| wget https://github.com/intel/compute-runtime/releases/download/22.41.24420/intel-level-zero-gpu-dbgsym_1.3.24420_amd64.ddeb |
| wget https://github.com/intel/compute-runtime/releases/download/22.41.24420/intel-level-zero-gpu_1.3.24420_amd64.deb |
| wget https://github.com/intel/compute-runtime/releases/download/22.41.24420/intel-opencl-icd-dbgsym_22.41.24420_amd64.ddeb |
| wget https://github.com/intel/compute-runtime/releases/download/22.41.24420/intel-opencl-icd_22.41.24420_amd64.deb |
| wget https://github.com/intel/compute-runtime/releases/download/22.41.24420/libigdgmm12_22.2.0_amd64.deb |
| sudo dpkg -i *.deb |
| </code> |
| |
| [[https://devblogs.microsoft.com/commandline/oneapi-l0-openvino-and-opencl-coming-to-the-windows-subsystem-for-linux-for-intel-gpus/|OneAPI/L0, OpenVINO and OpenCL coming to the Windows Subsystem for Linux for Intel GPUs]] {{ :prog:wsl:oneapi_l0_openvino_and_opencl_coming_to_the_windows_subsystem_for_linux_for_intel_gpus_-_windows_command_line_20_10_2022_12_19_04_.html |Archive du 04/11/2021 le 20/10/2022}} |
| |
| [[https://www.intel.com/content/www/us/en/artificial-intelligence/harness-the-power-of-intel-igpu-on-your-machine.html|Harness the power of Intel iGPU on your machine]] {{ :prog:wsl:harness_the_power_of_intel_igpu_on_your_machine_20_10_2022_12_04_09_.html |Archive du 04/11/2021 le 20/10/2022}} |
| |
| [[https://github.com/intel/compute-runtime/releases/|Release 22.41.24420]] {{ :prog:wsl:releases_intel_compute-runtime_20_10_2022_12_33_50_.html |Archive du 14/10/2022 le 20/10/2022}} |
=====Distribution Gentoo===== | =====Distribution Gentoo===== |
| |
LDFLAGS="-Wl,--as-needed -Wl,-O0" | LDFLAGS="-Wl,--as-needed -Wl,-O0" |
| |
USE="-X -gtk -nls -doc -rdoc -alsa gmp threads openmp" | USE="X gtk -nls -doc -rdoc -alsa gmp threads openmp" |
| |
VIDEO_CARDS="dummy" | VIDEO_CARDS="nvidia" |
| |
FEATURES="-ipc-sandbox -pid-sandbox -mount-sandbox -network-sandbox splitdebug noclean compressdebug" | FEATURES="-ipc-sandbox -pid-sandbox -mount-sandbox -network-sandbox splitdebug noclean compressdebug" |
| |
[[https://developer.moe/gentoo-on-wsl-2|Running Gentoo on Window 10 WSL 2]] {{ :prog:wsl:gentoo_on_windows_10_wsl_2_2020-07-10_09_49_57_.html |Archive du 11/2020 le 10/07/2020}} | [[https://developer.moe/gentoo-on-wsl-2|Running Gentoo on Window 10 WSL 2]] {{ :prog:wsl:gentoo_on_windows_10_wsl_2_2020-07-10_09_49_57_.html |Archive du 11/2020 le 10/07/2020}} |
| |
| Vous devez impérativement utiliser WSL 2 avec des drivers [[https://developer.nvidia.com/cuda/wsl|NVIDIA]] ({{ :prog:wsl:gpu_in_windows_subsystem_for_linux_wsl_nvidia_developer_2022-05-28_23_07_57_.html |archive du 2022 le 28/05/2022}}) à jour et [[https://docs.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl|Windows 10 21H2 / Windows 11]] ({{ :prog:wsl:enable_nvidia_cuda_on_wsl_2_microsoft_docs_2022-05-28_23_09_00_.html |archive du 14/02/2022 le 28/05/2022}}). |
| |
===Configure des options de compilation=== | ===Configure des options de compilation=== |
| |
<file txt /etc/portage/env/prod> | <file txt /etc/portage/env/prod> |
COMMON_FLAGS="${COMMON_FLAGS} -O3 -g0 -fomit-frame-pointer" | COMMON_FLAGS="${COMMON_FLAGS} -O2 -g0 -fomit-frame-pointer" |
CFLAGS="${COMMON_FLAGS} -O3 -g0 -fomit-frame-pointer" | CFLAGS="${COMMON_FLAGS} -O2 -g0 -fomit-frame-pointer" |
CXXFLAGS="${COMMON_FLAGS} -O3 -g0 -fomit-frame-pointer" | CXXFLAGS="${COMMON_FLAGS} -O2 -g0 -fomit-frame-pointer" |
FCFLAGS="${COMMON_FLAGS} -O3 -g0 -fomit-frame-pointer" | FCFLAGS="${COMMON_FLAGS} -O2 -g0 -fomit-frame-pointer" |
FFLAGS="${COMMON_FLAGS} -O3 -g0 -fomit-frame-pointer" | FFLAGS="${COMMON_FLAGS} -O2 -g0 -fomit-frame-pointer" |
LDFLAGS="${LDFLAGS} -Wl,-O3" | LDFLAGS="${LDFLAGS} -Wl,-O2" |
</file> | </file> |
| |
| |
eselect profile list | eselect profile list |
eselect set default/linux/amd64/xx.x/systemd | eselect profile set default/linux/amd64/xx.x/systemd |
| |
sed -i "s/12sg/012sg/g" /var/db/repos/gentoo/eclass/flag-o-matic.eclass | sed -i "s/123szg/0123szg/g" /var/db/repos/gentoo/eclass/flag-o-matic.eclass |
eix-update | eix-update |
emerge --oneshot --deep -va sys-devel/gcc | emerge --oneshot --deep -va sys-devel/gcc |
===Noyau=== | ===Noyau=== |
| |
Arrêter wsl. Faire ''exit'' depuis WSL. Faire ''%%wsl --shutdown%%'' pour arrêter les machines virtuelles. | Pour savoir la version du noyau de la VM, lancer : ''uname -a''. |
| |
| Pour savoir la dernière version du noyau existant, aller dans le dépôt Github de [[https://github.com/microsoft/WSL2-Linux-Kernel/releases|WSL2-Linux-Kernel]] et vérifier la dernière version disponible. |
| |
| Lancer la mise à jour avec ''%%wsl --update%%''. |
| |
Réinstaller la mise à jour du [[https://aka.ms/wsl2kernel|noyau WSL2]]. | Arrêter ''wsl''. Faire ''exit'' depuis WSL. Faire ''%%wsl --shutdown%%'' pour arrêter les machines virtuelles. |
| |
Relancer la machine virtuelle avec ''wsl ~ -d Gentoo''. | Relancer la machine virtuelle avec ''wsl ~ -d Gentoo''. |
<code bash> | <code bash> |
emerge --sync | emerge --sync |
sed -i "s/12sg/012sg/g" /var/db/repos/gentoo/eclass/flag-o-matic.eclass | layman -S |
| sed -i "s/123szg/0123szg/g" /var/db/repos/gentoo/eclass/flag-o-matic.eclass |
eix-update | eix-update |
| |
emerge -1vuDaN --keep-going @world | emerge -1vuDaN --keep-going @world |
# Update long mais plus complet et gérant mieux les conflits. | # Update long mais plus complet et gérant mieux les conflits. |
emerge --backtrace=30 --update --deep --newuse --keep-going -va --autounmask-keep-masks --with-bdeps=y --complete-graph=y --autounmask-write --verbose-conflicts @world | emerge --backtrack=30 --update --deep --newuse --keep-going -va --autounmask-keep-masks --with-bdeps=y --complete-graph=y --autounmask-write --verbose-conflicts @world |
| |
emerge -va --keep-going @live-rebuild | emerge -va --keep-going @live-rebuild |