Hi, guys. I am a fan of deep reinforcement learning. In order to break the bottleneck of computing power, I tried to add GPU functions in QuantConnect/research images. Please following the steps:

1. install Win11 and Docker2. Install WSL on Windows 10: https://docs.microsoft.com/zh-cn/windows/wsl/install3. install Lean4. docker pull quantconnet/research:latest 

7. install GPU in Windows Subsystem for Linux (WSL)  https://developer.nvidia.com/cuda/wsl  6. install cuda  wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda-repo-wsl-ubuntu-11-4-local_11.4.2-1_amd64.deb dpkg -i cuda-repo-wsl-ubuntu-11-4-local_11.4.2-1_amd64.deb apt-key add /var/cuda-repo-wsl-ubuntu-11-4-local/7fa2af80.pub apt-get update apt-get -y install cuda 7. commit the changes of imaged239f9553fef is the id of the containerdocker commit -m="try to add gpu" -a="otw" d239f9553fef quantconnect/research:gpu

8. run new vesion of image using bashdocker run -t -i --gpus all quantconnect/research:gpu /bin/bash

9. Test the result:

cd /usr/local/cuda-11.4/samples/4_Finance/BlackScholesmake BlackScholes./BlackScholes

The ouput:

[./BlackScholes] - Starting...GPU Device 0: "Ampere" with compute capability 8.6

Initializing data......allocating CPU memory for options....allocating GPU memory for options....generating input data in CPU mem....copying input data to GPU mem.Data init done.

Executing Black-Scholes GPU kernel (512 iterations)...Options count             : 8000000BlackScholesGPU() time    : 0.258305 msecEffective memory bandwidth: 309.711765 GB/sGigaoptions per second    : 30.971176

BlackScholes, Throughput = 30.9712 GOptions/s, Time = 0.00026 s, Size = 8000000 options, NumDevsUsed = 1, Workgroup = 128

Reading back GPU results...Checking the results......running CPU calculations.

Comparing the results...L1 norm: 1.741792E-07Max absolute error: 1.192093E-05

Shutting down......releasing GPU memory....releasing CPU memory.Shutdown done.

[BlackScholes] - Test Summary

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

Test passed

 

 

Can someone edit the lean package in pip:

when we run lean research “project new” , we need to run a similar code background.

docker run -t -i --gpus all quantconnect/research:gpu /bin/bash

we need add “--gpus all” in the code of lean. (\lean-1.0.71\lean\commands\research.py), can someone edit the code?

 

 

Author