Saturday, May 4, 2019

Building Visual Studio Code on Jetson Nano

Here are the steps for building Visual Studio Code on Nvidia Jetson Nano.

Install nodejs

Visual Studio Code needs node version between 8 and 10. To install node 10 and yarn:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

sudo apt-get install -y nodejs

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update && sudo apt-get install yarn


Install libraries 

We also need some libraries:

sudo apt-get install libx11-dev libxkbfile-dev libsecret-1-dev 


Clone and build Visual Studio Code

In a working directory, clone the source code and build.

git clone https://github.com/microsoft/vscode

cd vscode

scripts/npm.sh install


Edit 2019-06-15: To enable extensions, edit the product.json file and add the following:

"extensionsGallery": {
  "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
  "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
  "itemUrl": "https://marketplace.visualstudio.com/items"
}


To run Visual Studio Code:

scripts/code.sh

Friday, May 3, 2019

ROCm OpenCL with openSUSE Tumbleweed

EDIT 2022:

Follow the latest doc instead: https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.4/page/How_to_Install_ROCm.html

EDIT 20200622:
With ROCm 3.5, the easiest way is to use zypper.

- Add repository:
sudo zypper addrepo --no-gpgcheck http://repo.radeon.com/rocm/zyp/zypper/ rocm
sudo zypper ref

- Install packages:
sudo zypper in rocm-opencl3.5.0 hsa-ext-rocr-dev3.5.0

- Update lib path (if necessary). ROCm 3.5 is installed under "/opt/rocm-3.5.x". Create a symbolic link "/opt/rocm -> /opt/rocm-3.5.1". Check the lib path in /etc/ld.so.conf.d and make sure these are listed

  - /opt/rocm/lib
  - /opt/rocm/lib64
  - /opt/rocm/hsa/lib
  - /opt/rocm/opencl/lib

If not, create a new file (e.g. rocm.conf) and add the above paths.  Then run "sudo ldconfig".

Run both "/usr/bin/clinfo" and "/opt/rocm/opencl/bin/clinfo" to check if OpenCL is working.



EDIT 20200110:
(0) As of 2020-01-05, running "clinfo" with openSUSE Tumbleeweed 20200103 and these  ROCm packages will cause null pointer dereference errors.
(0) Things are working again with Tumbleeweed 20200108.
(1) The user needs to be member of the "video" group.  Run this command to add yourself to the group "sudo usermod -a -G video $LOGNAME"
(2) The site now has RPM packages for openSUSE.  Go the http://repo.radeon.com/rocm/zyp/zypper/ to download the packages instead.  Also, no need to specify "--nodeps" when installing the packages

- - 8< - - -


With Tumbleweed running Linux kernel 5.0, it is easy to install ROCm OpenCL with upstream kernel.

- Go to http://repo.radeon.com/rocm/zyp/zypper/ and download the latest version of following packages:

hsakmt-roct
hsa-rocr-dev
rocm-opencl
rocm-opencl-devel
rocminfo-1.0.0

(EDIT 20200126) With ROCm 3.0, you also need to install these packages (due to an issue):
comgr
rocm-smi-lib64

- Install them without checking dependencies, assuming you already have libc etc packages installed, e.g.:

sudo rpm -ivh comgr-1.6.0.121-cbb02f9-Linux.rpm hsakmt-roct-1.0.9-319-g02e2b30.x86_64.rpm hsa-rocr-dev-1.1.30100.0-local-build-ecafeba1-Linux.rpm rocm-opencl-2.0.0--8f28d95ad-Linux.rpm rocm-opencl-devel-2.0.0--8f28d95ad-Linux.rpm rocm-smi-lib64-2.2.0.8.local-build-0-a246aac.rpm rocminfo-1.0.0.0.local_build-0-a134847.rpm

- That's it! Optionally, install clinfo with zypper to check the available platforms.  Or you can just use the one installed by rocminfo (under /opt/rocm*/bin). If you have been using Mesa OpenCL, you may want to uninstall it.