Closed BorisVSchmid closed 1 year ago
Thanks! Do I understand well that this works, and the issue can be closed?
Issue can be closed. Neanderthal on WSL seems to work for native and cuda, but not opencl. And that seems to be what to expect from WSL2 at the moment (https://github.com/microsoft/WSL/issues/6951).
Matches what I see when I run lein test on neanderthal's repository, there are three test files that fail (clblast_test.clj, clblast_cpu_test.clj, and tutorial_opencl_test.clj.fail).
If I disable those tests, lein test completes. One exception, that might be worth looking in: I have this error popping up a dozen of times:
FAIL div at (mkl_test.clj:130)
Actual result did not agree with the checking function.
Actual result:
clojure.lang.ExceptionInfo: LAPACK error. {:bad-argument 5, :error-code -5}
uncomplicate.neanderthal.internal.host.mkl.DoubleTREngine.copy(mkl.clj:1511)
uncomplicate.neanderthal.internal.host.buffer_block.RealUploMatrix.host(buffer_block.clj:1243)
uncomplicate.neanderthal.core$transfer.invokeStatic(core.clj:135)
uncomplicate.neanderthal.math_test$diff_square_2.invokeStatic(math_test.clj:106)
uncomplicate.neanderthal.math_test$diff_square_2.invokeStatic(math_test.clj:102)
uncomplicate.neanderthal.math_test$diff_square_2.invoke(math_test.clj:102)
uncomplicate.neanderthal.math_test$test_math$fn__55902$fn__55903$fn__55904.invoke(math_test.clj:130)
uncomplicate.neanderthal.math_test$test_math$fn__55902$fn__55903.invoke(math_test.clj:130)
uncomplicate.neanderthal.math_test$test_math$fn__55902.invoke(math_test.clj:130)
uncomplicate.neanderthal.math_test$test_math.invokeStatic(math_test.clj:127)
uncomplicate.neanderthal.math_test$test_all_host.invokeStatic(math_test.clj:233)
uncomplicate.neanderthal.mkl_test$eval56456.invokeStatic(mkl_test.clj:103)
uncomplicate.neanderthal.mkl_test$eval56456.invoke(mkl_test.clj:103)
Checking function: (zero)
For those without a linux environment, a plus from running neanderthal in WSL is that it is easy to install a system-wide MKL, and that [org.bytedeco/mkl-platform-redist "2022.0-1.5.7"] works. Both of those currently are non-trivial to get to work when staying in windows.
This is a little bit a duplicate from the issues #119 and #127, but as I don't seem to run into any trouble getting neanderthal to run on the WSL2, with support of CUDA, it seems worth posting it as a separate issue with a clear title.
Using sublime text as an IDA and the Terminus / Clojure Sublimed packages, I can start a WSL as a terminal, and connect Clojure Sublimed to a clj -M:repl nrepl I start in that terminal. After that, everything is smooth sailing.
These are the steps I took to get neanderthal to run on the WSL. Nothing exotic.
Neanderthal on the WSL2
install WSL & Ubuntu
Go to /users/ and make a file called .wslconfig, and add (and adapt to your system) the following text into the file
Else your WSL only gets access to 6GB of memory or so.
install MKL and clojure in Ubuntu
sudo apt-get update
sudo apt-get install intel-mkl choose the default in the install screen (libmkl_rt is not the default alternative to BLAS/LAPACK)
sudo apt-get install clojure As installing clojure in this way doesn't get you the clojure tools ('clj'), I am also installing clojure through homebrew, just minus the 1 million dependencies.
sudo apt-get install build-essential
execute /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
execute eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
nano ~/.bashrc and paste eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" as the top line
run brew install --ignore-dependencies clojure
brew will install clojure for you with the clojure tools (clj). And the ignore dependencies saves you from a ton of weird stuff being installed
sudo apt-get install leiningen
Testing in hello_world of neanderthal
Getting the GPU to work.
GPU won't work yet in the above setting (native will). There is a large block of text available here explaining some of the below steps: https://docs.nvidia.com/cuda/wsl-user-guide/index.html
From the article, and within WSL
Note, that if you look up the syntax to install other packages than 11.7.0 on https://developer.nvidia.com/cuda-downloads?, it will almost give you the correct syntax, just not the last line - the article on how to install cude and wsl specifically warns against that, but it is easy to miss.
So in our case , make sure to do: