Skip to content

Getting Started on Linux

Carole Hayakawa edited this page Dec 10, 2020 · 29 revisions

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

Prerequisites

  • An installation of git. To install on Ubuntu 18.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 3.1 runtime, on Ubuntu 18.04 the commands are:
wget https://packages.microsoft.com/config/ubuntu/18.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 apt-transport-https 
sudo apt-get update 
sudo apt-get install -y dotnet-runtime-3.1
sudo apt-get install -y dotnet-sdk-3.1
  • An installation of powershell, on Ubuntu 19.04 the commands are:
# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of products
sudo apt-get update
# Enable the "universe" repositories
sudo add-apt-repository universe
# 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/netcoreapp2.1/

To generate sample infiles for MCCL

dotnet mc.dll geninfiles

To run MCCL with sample infile

dotnet mc.dll infile=infile_one_layer_all_detectors.txt

Clone this wiki locally