Giter Club home page Giter Club logo

vscode-sycl-dpcpp-cuda's Introduction

VS Code Development Container: SYCL for NVIDIA GPUs via DPC++'s CUDA Backend

Open in Remote - Containers

This project provides a development container for developing applications in SYCL for NVIDIA GPUs using the CUDA backend of the oneAPI DPC++ (Data Parallel C++) compiler.

It uses Podman as container engine to run the container rootless.

The setup has been tested on Fedora Linux 36 with Podman version 4.1.0.

Prerequisites

Beside having installed Podman and VS Code, you need to setup the NVIDIA Container Toolkit before being able to start the development container.

Podman

You can install Podman on Fedora using

sudo dnf install -y podman

NVIDIA Container Toolkit

The instructions to set up the NVIDIA Container Toolkit are based on this guide by Red Hat.

  1. Install the NVIDIA GPU driver using RPM Fusion. Note that you do not need to install CUDA, it is included in the container.

  2. Configure the repository:

curl -sL https://nvidia.github.io/nvidia-docker/rhel9.0/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo
  1. Install the nvidia-container-toolkit package.
sudo dnf install -y nvidia-container-toolkit
  1. To allow running the container rootless, you need to apply 3 changes to /etc/nvidia-container-runtime/config.toml.
#no-cgroups = false
no-cgroups = true
#ldconfig = "@/sbin/ldconfig"
ldconfig = "/sbin/ldconfig"
#debug = "/var/log/nvidia-container-runtime.log"
debug = "~/.local/nvidia-container-runtime.log"
  1. Finally, install and apply a SELinux policy to enable GPU access within the container.
curl -sLO https://raw.githubusercontent.com/NVIDIA/dgx-selinux/master/bin/RHEL7/nvidia-container.pp
sudo semodule -i nvidia-container.pp
sudo nvidia-container-cli -k list | sudo restorecon -v -f -
sudo restorecon -Rv /dev

Remote - Containers Extension

First install the Remote - Containers extension for VS Code.

By default, the extension is configured to use Docker, therefore you have to go to user settings, Extensions, Remote - Containers, and change Remote โ€บ Containers: Docker Path to podman.

Docker Path setting

Usage

Once you followed the setup instructions above, open this project in VS Code and you should see a prompt that suggests to reopen this project in a container.

Reopen project in container

The src folder contains an example program. You can compile it, and any other source file, by opening the source file in VS Code and executing the build task by pressing Ctrl+Shift+B, or open the Command Palette (F1, Ctrl+Shift+P) and search for Run Build Task. Using the Command Palette, the compiled program can be executed via the Run Test Task.

vscode-sycl-dpcpp-cuda's People

Contributors

sebp avatar

Watchers

 avatar  avatar

Forkers

max13fr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.