JETSCAPE Framework: Installation, Compilation And Testing

Prerequisites https://sites.google.com/a/lbl.gov/jetscape2018/home/school-material/framework Prerequisites: • C++ Compiler with C++11 support • CMake version 3 and above • zlib (should be already installed) Recommended Installation of the Prerequisites: Windows: Windows is currently not supported. We recommend you install a virtual machine https://www.storagecraft.com/blog/the-dead-simple-guide-to-installing-a-linux-virtual-machine-on-windows and a recent version of Scientific Linux. Then follow the instructions for Linux. Apple Mac: 1 Install a recent version of Xcode from the App Store; it should provide clang version 3.3 or above. 2 Install the command line tools: Open a Terminal and enter (without the "%") ◦

3 4 5

% xcode-select --install

Install Homebrew. Install cmake: Open a Terminal and enter (without the "%") ◦

% brew install cmake



% brew install zlib

If necessary, install zlib: Open a Terminal and enter (without the "%")

Prerequisites Linux: Note: It is assumed that you have administrator permissions or can obtain them using sudo. If that is not the case, please contact your System Adminstrator. 1 Ensure gcc version 4.8.1 or above: In the command line, enter (without the "%") ◦

2 3

4 5

% gcc --version

If the version is too low, please update to the required version If necessary, install cmake using your distribution's package manager. In this example we assume yum, but it can be replaced apt-get or port as appropriate:
 In the command line, enter (without the "%") ◦

% sudo yum install cmake



% sudo yum install zlib

If the version is too low, please update to the required version If necessary, install zlib: In the command line, enter (without the "%")

Optional: The last session of the workshop will focus on an "analysis" of JETSCAPE output. For histogramming and visualization, we recommend ROOT v. 6, an existing version of which will be picked up during installation. It can be installed with package managers the same manner as the required dependencies, i.e. % brew install root

or % sudo yum install root

Note: Please make us ([email protected]) aware of any other packages you would like to use instead.

JETSCAPE – Installation and Compilation Installation of the Framework: 1 Download the source. (this is the zip file attached to this page) 2 In the command line, navigate to the directory where you want to install, move the zip 
 file here, and enter (without the "%"): ◦ % unzip JETSCAPE-SCHOOL.zip ◦ % cd JETSCAPE-SCHOOL ◦ % mkdir build ◦ % cd build ◦ % cmake ../ ◦ % make 3 Test with the following commands which should produce an output file named test_out.dat: ◦ % ./brickTest ◦ % ./readerTest We encourage all attendants to familiarize themselves with the code and experiment with it!

JETSCAPE - Testing • Inside build directory, you can run different tests • ./brickTest • ./readerTest • ./readerTestWithRoot

(Quick) Introduction 
 to C++11

Useful New Features • Automatic Type Deduction • Null Pointer • Smart Pointer • Range-based for Loops

Automatic Type Deduction : auto • auto is a placeholder for a type • Enables type inference

auto i = 42; // i is an int auto l = 42LL; // l is an long long auto p = new foo(); // p is a foo*

• can be used when declaring variables in different scopes • namespaces, • Blocks, or • initialization statement of for loops

• Using auto usually means less code

Null Pointer : nullptr • Zero (0) used to be the value of null pointers • Problem: the implicit conversion to integral types

• The keyword nullptr denotes a value of type std::nulptr_t • Represents the null pointer literal

• No more implicit conversion to integral types.

Smart Pointers • A wrapper class over a pointer with operators like * and -> overloaded • The objects of smart pointer class look like pointer, but can do many things that a normal pointer can’t like automatic destruction • we don’t have to explicitly use delete

• Destructor is automatically called when an object goes out of scope • The dynamically allocated memory would automatically deleted

Types of Smart Pointers • unique_ptr • Should be used when ownership of a memory resource does not have to be shared • It doesn't have a copy constructor, but it can be transferred to another unique_ptr

• shared_ptr • Should be used when ownership of a memory resource should be shared

• weak_ptr • Holds a reference to an object managed by a shared_ptr, but does not contribute to the reference count;

Allocating Memory • make_shared (make_unique in helper.h) • a non-member function for allocating memory for the shared object and the smart pointer

• Creating a smart pointer of type Foo auto foo = std::make_shared();

Example: (brickTest.cc)

// Main framework task int Nevents = 10; auto jetscape = make_shared("./jetscape_init.xml",Nevents); jetscape->SetId("primary"); // Empty initial state auto ini = make_shared(); ini->SetId("InitialState"); // mono-energetic particle gun, parameters in XML file // 25% probability each for g, u, d, s auto pGun= make_shared (); // Simple brick, parameters in XML file auto hydro = make_shared (); // Energy loss manager, parameters in XML file auto jlossmanager = make_shared (); … //Remark: For now modules have to be added in proper "workflow" order jetscape->Add(ini); jetscape->Add(pGun); jetscape->Add(hydro); … // Intialize all modules tasks jetscape->Init(); // Run JetScape with all task/modules as specified ... jetscape->Exec(); jetscape->Finish();

Ranged-Based for Loops • Like the foreach paradigm of iterating over collections • useful when you just want to get and do something with the elements of a collection/array • you don't care about indexes, iterators or number of elements std::vector v = {1,2,3,4,5}; for(auto i : v){ std::cout << i << ‘ ‘; }

Task-Based Framework And Adding a Hello World Task/ Module

Task-Based Framework • JETSCAPE Framework provides base classes • JetScapeTask • All the tasks in the framework are subclasses of this class • Methods called recursively by framework • Init() • Exec() • Finish() • Clear()

• Each task must implement these methods

Add Your Module: Hello World! • Add the header file • overrides JetScapeTask • Methods are virtual • Will be implemented 
 in source file To add you own task or module: - Create a header file *.h - Create a source file *.cc You can add these test files simple in the framework folder. If your code ends with .cc than cmake will automatically find and compile!

#ifndef HELLOWORLDMODULETEST_H #define HELLOWORLDMODULETEST_H #include "JetEnergyLossModule.h" using namespace Jetscape; class HelloWorld : public JetScapeTask { public: HelloWorld(); virtual ~HelloWorld(); virtual void WriteTask(weak_ptr w); virtual virtual virtual virtual };

void void void void

Init(); Exec(); Clear(); Finish();

Add Your Module: 
 Hello World!

• Add the source file • Implements 
 JetScapeTask methods

#include "HellowWorldModuleTest.h" #include using namespace Jetscape; HelloWorld::HelloWorld() { SetId("HellowWorld"); VERBOSE(8); } HelloWorld::~HelloWorld() { VERBOSE(8); } void HelloWorld::Init() { INFO<<"Initialize HelloWorld Module ..."; } void HelloWorld::Exec(){ INFO<<"This is the Module Executing... HELLO WORLD!..."; } void HelloWorld::Clear() { INFO<<"This is the Module Clearing..."; } void HelloWorld::Finish() { INFO<<"This is the Module Finishing..."; }

Add Your Hello World Module in Brick test • Include the header file • #include "HellowWorldModuleTest.h"

• Create a pointer • auto helloWorld = make_shared ();

• Attach the pointer to the main task • jetscape->Add(helloWorld);

• Framework will run your module

JETSCAPE Framework: Installation, Compilation And ...

Windows: Windows is currently not supported. We recommend you install a virtual machine https://www.storagecraft.com/blog/the-dead-simple-guide-to-installing-a-linux-virtual-machine-on-windows and a recent version of Scientific Linux. Then follow the instructions for Linux. Apple Mac: 1 Install a recent version of Xcode ...

274KB Sizes 4 Downloads 195 Views

Recommend Documents

FPLLL - Installation, Compilation, Dependencies - GitHub
Jul 6, 2017 - 2. ./configure (optional: --prefix=$PREFIX). 3. make (optional: -jX for X ... .gnu.org/software/libtool/manual/html_node/Updating-version-info.html ...

Program Modules, $eparate Compilation, and ...
agated to other modules and ( 2 ) no code is generated for module language ..... The specialisation of ModML functors is much similar to ho w Ada generic.

Compilation of SACP, SADTU and ANC statements
Mar 6, 2013 - NEC Lekgotla on the issues of making education an essential service. ... individuals but individuals who are able to interpret and make sense .... that call others “funny people” and appeal to members to crush leaders to stop.

Digests Compilation
technology (e.g. Sociology) or (3) a creator of business value derived from technological and social structures of the new web (e.g. Business Administration). From the perspective of the authors of this paper, Web 2.0 is a natural evolution of the we

Digests Compilation
annotate the content and express implicit relations among wiki concepts. This aids users to gradually ... typed links, concept types and properties. In addition, it ...

compilation asa akira.pdf
cumpilation. Spankwire. asa akira compilation. Asa akira anal crazyjizz.comfree porn videos. Asa akira compilation,. free asian porn video 3c xhamster. Asa akira compilation. pornhub.com. Youporn compilation videos xxx, free porn movies. Asa akira ho

INSTALLATION, MAINTENANCE AND TROUBLESHOOTING OF ...
INSTALLATION, MAINTENANCE AND TROUBLESHOOTING OF COMPUTER NETWORKS.pdf. INSTALLATION, MAINTENANCE AND TROUBLESHOOTING ...Missing:

pdf-1443\supplemental-a-compilation-of-the-messages-and ...
... the apps below to open or edit this item. pdf-1443\supplemental-a-compilation-of-the-messages-a ... 1-1906-from-bureau-of-national-literature-and-art.pdf.

A Compilation of all MCA circulars and notifications ... -
notification dated. 12.9.2013. Statement to be annexed to notice shall be under Sec. 102 for statements after 11 Sep 2013. Circular. 2013 General Circular No.

CUDA Compilation and execution in Visual Studio.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. CUDA ...

Open BEAGLE Compilation HOWTO
Oct 10, 2005 - This document is on the compilation of the Open BEAGLE1 C++ framework for evolutionary computations. ..... #define BEAGLE_FULL_DEBUG.

PublicAgent compilation tour video
Problemsolving pdf. ... video KingDuncan did die he had sonsand theywould take over the PublicAgentcompilation tour video ofScotland,and the Thane ...

GK Today February Compilation 2018 [www.aimbanker.com].pdf ...
Integrated Automatic Aviation Meteorological Systems inaugurated at INS Garuda ................................................................................... 47. India, Palestine .... Indian Army contributes 2,300 personnel for UN peace keeping

ELECTRICAL INSTALLATION AND MAINTENANCE WORKS 2007 ...
Page 3 of 7. ELECTRICAL INSTALLATION AND MAINTENANCE WORKS 2007-unprotected.pdf. ELECTRICAL INSTALLATION AND MAINTENANCE WORKS ...

ELECTRICAL INSTALLATION AND MAINTENANCE WORKS 2008 ...
(iii) Pull Switch. (iv) Bell Indicator. (b) Explain ... Page 3 of 9. ELECTRICAL INSTALLATION AND MAINTENANCE WORKS 2008-unprotected.pdf. ELECTRICAL ...

INSTALLATION, START-UP AND SERVICE INSTRUCTIONS
depending on size and application. The 39G Galaxy central station air handling unit are built up in "Modules". (Refer to Fig. 3). Any unit which is 22M (module) or longer in length will be shipped in shorter sections. 3.3 Do not remove skids or prote

Differential Controller Operating and Installation Instructions - Docuthek
local electrical power supply utility and the VDE ... System 1 = Solar differential regulation. 16 ..... solar energy system) or ask the installation technician.