Skip to content

Getting Started on Linux

Carole Hayakawa edited this page Mar 14, 2024 · 27 revisions

These instructions describe how to clone the source code on linux and build it

Prerequisites

  • An installation of git. To install on Ubuntu 22.04, bring up a terminal window and type:
sudo apt-get update
sudo apt-get install git
git config --global user.name "yournamehere"
git config --global user.email "youremailaddresshere"
  • An installation of dotnet 6.0 runtime, on Ubuntu 22.04 the commands are:
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-6.0
sudo dpkg -i packages-microsoft-prod.deb && \ 
  sudo apt-get update && \
  sudo apt-get install -y aspnetcore-runtime-6.0
rm packages-microsoft-prod.deb
  • An installation of powershell, on Ubuntu 22.04 the commands are:
# Update the list of packages
sudo apt-get update
wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
# Install the Microsoft repository configuration package
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of products
sudo apt-get update
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell
pwsh

Getting the Source Code

Clone the source code from GitHub using the command:

git clone https://github.com/VirtualPhotonics/Vts.MonteCarlo.git

This will create a directory "Vts.MonteCarlo" in your current directory.

Building the Code

  • Using powershell:
cd Vts.MonteCarlo
pwsh
./BuildTestReleaseMCCL.ps1 4.10.0
exit

The 4.10.0 is any version number you'd like to specify. The BuildTestReleaseMCCL.ps1 script builds the software, creates three MCCL zip files for linux, Mac and Windows, and runs unit tests, some with MATLAB. If you don't have MATLAB installed, please ignore those error messages.

  • Using command line: The Monte Carlo command-line (MCCL) application and the post processor application are .NET Core and can also be built using dotnet build:
dotnet build Vts.MonteCarlo.CommandLineApplication/Vts.MonteCarlo.Application.csproj -c Debug
dotnet build Vts.MonteCarlo.CommandLineApplication/Vts.MonteCarlo.Application.csproj -c Release
dotnet build Vts.MonteCarlo.PostProcessor/Vts.MonteCarlo.PostProcessor.Application.csproj -c Debug
dotnet build Vts.MonteCarlo.PostProcessor/Vts.MonteCarlo.PostProcessor.Application.csproj -c Release

The unit tests can be run using dotnet build and dotnet test on the test projects: MCCL Tests

dotnet build Vts.MonteCarlo.CommandLineApplication.Test/Vts.MonteCarlo.Application.Test.csproj -c Debug
dotnet build Vts.MonteCarlo.CommandLineApplication.Test/Vts.MonteCarlo.Application.Test.csproj -c Release
dotnet test Vts.MonteCarlo.CommandLineApplication.Test/Vts.MonteCarlo.Application.Test.csproj -c Debug
dotnet test Vts.MonteCarlo.CommandLineApplication.Test/Vts.MonteCarlo.Application.Test.csproj -c Release

MCPP Tests

dotnet build Vts.MonteCarlo.PostProcessor.Test/Vts.MonteCarlo.PostProcessor.Application.Test.csproj -c Debug
dotnet build Vts.MonteCarlo.PostProcessor.Test/Vts.MonteCarlo.PostProcessor.Application.Test.csproj -c Release
dotnet test Vts.MonteCarlo.PostProcessor.Test/Vts.MonteCarlo.PostProcessor.Application.Test.csproj -c Debug
dotnet test Vts.MonteCarlo.PostProcessor.Test/Vts.MonteCarlo.PostProcessor.Application.Test.csproj -c Release

To execute any application, e.g. Monte Carlo CommandLine (MCCL):

cd src/Vts.MonteCarlo.CommandLineApplication/bin/Debug/net6.0/

To generate sample infiles for MCCL

./mc geninfiles

To run MCCL with sample infile

./mc infile=infile_one_layer_all_detectors.txt

Clone this wiki locally