Giter Site home page Giter Site logo

pandaroot-wsl's Introduction

date
2024-02-07

PandaRoot container for WSL

This page describes how to build and and run PandaRoot inside a Docker container on Windows Subsystem for Linux (WSL). Install WSL following these official instructions. It's best to stick to the defaults: just chose Ubuntu as Linux distro. If you installed Visual Studio Code, have a look at this tutorial on WSL and VSCode.

1. Docker container

The first part of these instructions focus on terminal commands only. The goal is to build the PandaRoot source code within a Docker container that has FairROOT installed. In , we automate this process, so that the container launches directly when you start VSCode.

1.1. Install Docker

In a terminal in WSL, install Podman, which is can be used to run Docker containers without admin (sudo) rights.

sudo apt install podman-docker

::::{tip} Tips about Docker :class: dropdown Images are immutable files that are downloaded from Docker Hub or other registries. Once a specific tag of an image is downloaded, it is stored and you don't need to download it again. The downloaded images can be listed with

docker images -a

Containers are created once you run an image. An example is the following command, which runs an image for the latest release of Debian:

docker run --rm -it docker.io/debian:latest bash

:::{important} Images and containers can take up a lot of space, so you want to remove them as soon as you don't run them anymore. The --rm removes the container after you close it. See this nice explainer on YouTube for more info. ::: ::::

1.2. FairSoft container with PandaRoot

If you haven't already, clone the PandaRoot source code:

git clone [email protected]:PandaRootGroup/PandaRoot

and navigate into the cloned repository:

cd PandaRoot

Next, run this FairSoft Docker image and bind (-v) the current working directory with the PandaRoot source code to the container:

docker run --rm -it \
  -v "$(pwd)":/mnt/work/PandaRoot \
  -w /mnt/work/PandaRoot \
  tstockmanns/fairroot_v18_6_fairsoft_apr22_ubuntu_22

You now have a terminal before you inside the FairSoft container, with access to the cloned PandaRoot source code.

1.3. Build and test PandaRoot

You are now ready to build PandaRoot using these (internal) instructions on GitLab (see "Out-of-build installation" in particular):

mkdir build install -p
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install
make -j$(nproc) install

:::{admonition} The build process that starts when you run make can take up to 10Β min... β˜• :::

Once done, navigate back to the PandaRoot main directory and source the installed configuration:

. /mnt/work/PandaRoot/install/bin/config.sh -p

You can test whether the installation works with the rho/tut_sim.C script:

cd /mnt/work/PandaRoot/tutorials/rho
root -l -b -q tut_sim.C

After some minutes of generating events, you'll see something like:

....
<DartMeasurement name="MaxMemory" type="numeric/double">915.203</DartMeasurement>
<DartMeasurement name="CpuLoad" type="numeric/double">0.992</DartMeasurement>

Output file is          ./signal_sim.root
Parameter ROOT file is  ./signal_par.root
Parameter ASCII file is all.par
Real time 66.462 s, CPU time 65.940s
CPU usage 99.214%
Max Memory 915.203 MB
Macro finished successfully.
double free or corruption (!prev)

That means you're good to go! πŸŽ‰

2. VSCode Dev Container

Visual Studio Code can be run inside a Docker container, so that you don't have to run the commands described in . As of writing, the .devcontainer.json file in PandaRoot does not work on WSL. To fix this, do the following:

  1. Install the VSCode Dev Containers extension.

  2. Replace the contents of the .devcontainer.json file in the PandaRoot repository with the following:

    :filename: .devcontainer.json
    {
      "image": "tstockmanns/fairroot_v18_6_fairsoft_apr22_ubuntu_22",
      "postStartCommand": ". /mnt/work/PandaRoot/install/bin/config.sh",
      "workspaceFolder": "/mnt/work/PandaRoot",
      "workspaceMount": "source=${localWorkspaceFolder},target=/mnt/work/PandaRoot,type=bind,consistency=cached"
    }
    
  3. Bonus: To avoid always having to run the config.sh script when you launch the terminal, set the following in the settings for your VSCode workspace:

    :filename: .vscode/settings.json
    {
      "terminal.integrated.defaultProfile.linux": "PandaRoot",
      "terminal.integrated.profiles.linux": {
        "PandaRoot": {
          "args": ["-l", "-c", ". /mnt/work/PandaRoot/install/bin/config.sh; bash"],
          "path": "/bin/bash"
        }
      }
    }
    

pandaroot-wsl's People

Contributors

redeboer avatar

Watchers

 avatar

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.