Skip to content

Commit

Permalink
Merge pull request #22 from JeffersonLab/build
Browse files Browse the repository at this point in the history
Build "system" cleanup
  • Loading branch information
baltzell authored Apr 18, 2024
2 parents 6680e01 + 92190b3 commit b90b61e
Show file tree
Hide file tree
Showing 18 changed files with 169 additions and 303 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ errors.txt
.lesshst
RNDMSTATUS
LHAPDF*
genie
log4cpp*
pythia6*
root*
179 changes: 116 additions & 63 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,87 +1,140 @@

TOP = $(shell pwd)

SUBDIRS = clasdis claspyth dvcsgen inclusive-dis-rad TCSGen genKYandOnePion JPsiGen twopeg MCEGENpiN_radcorr deep-pipi-gen genepi gibuu onepigen genie

build: gibuu
mkdir -p bin lib
$(MAKE) -C clasdis
$(MAKE) -C claspyth
$(MAKE) -C dvcsgen
$(MAKE) -C genKYandOnePion
$(MAKE) -C inclusive-dis-rad
$(MAKE) -C JPsiGen
$(MAKE) -C TCSGen
$(MAKE) -C MCEGENpiN_radcorr
$(MAKE) -C deep-pipi-gen
$(MAKE) -C genepi
$(MAKE) -C onepigen
$(MAKE) -C genie
# twopeg needs c++17 support:
MAKEDIRS := $(shell find . -maxdepth 2 -mindepth 2 -name Makefile | awk -F/ '{print$$2}')
SUBMODULES := $(shell grep ^\\[submodule .gitmodules | awk -F\" '{print$$2}')
CLEANDIRS := $(MAKEDIRS)
MAKEDIRS := $(filter-out gibuu,$(MAKEDIRS))
MAKEDIRS := $(filter-out genie,$(MAKEDIRS))
MAKEDIRS := $(filter-out twopeg,$(MAKEDIRS))

TOP := $(shell pwd)

export GENIE := $(TOP)/genie

all: gibuu genie twopeg elspectro $(MAKEDIRS)

$(MAKEDIRS):
$(MAKE) -C $@
.PHONY: $(MAKEDIRS)

elspectro:
rm -rf build && mkdir build
+ cd build && cmake -DCMAKE_CXX_COMPILER=`which g++` -DCMAKE_C_COMPILER=`which gcc` ../
+ cd build && cmake --build . --target install
.PHONY: elspectro

twopeg:
sed -i 's/\(^CXX .*= g++ \)/\1 -std=c++17 /' twopeg/Makefile
# seems twopeg has a non-standard(?) Makefile and requires this instead:
cd twopeg ; $(MAKE) nobos ; cd --
# clas12-elSpectro uses cmake:
+ mkdir build && cd build && cmake -DCMAKE_CXX_COMPILER=`which g++` -DCMAKE_C_COMPILER=`which gcc` ../ && cmake --build . --target install && cd ..
install clas12-elSpectro/elSpectro/jpacPhoto/lib/* lib
install clasdis/clasdis bin
install claspyth/claspyth bin
install dvcsgen/dvcsgen bin
install genKYandOnePion/genKYandOnePion bin
install inclusive-dis-rad/inclusive-dis-rad bin
install JPsiGen/JPsiGen.exe bin
install JPsiGen/JPsiGen bin
install twopeg/twopeg bin
install JPsiGen/lib/libJPsiGen.so lib
install TCSGen/TCSGen.exe bin
install TCSGen/TCSGen bin
install TCSGen/lib/libTCSGen.so lib
install MCEGENpiN_radcorr/MCEGENpiN_radcorr bin
install deep-pipi-gen/deep-pipi-gen bin
install genepi/genepi bin
install generate-seeds.py bin
install onepigen/onepigen bin
install onepigen/onepigen_lund bin
rm -rf build

clean: prune
rm -rf bin lib lib64 build share include etc
for dir in $(SUBDIRS); do\
$(MAKE) -C $$dir clean; \
done
cd twopeg && $(MAKE) nobos
.PHONY: twopeg

prune:
rm -rf LHAPDF* log4cpp* pythia6*
gibuu: bin/GiBUU.x
lhapdf: lib/libLHAPDF.so
log4cpp: lib/liblog4cpp.so
pythia6: lib/libPythia6.so

gibuu: lhapdf
$(MAKE) -C gibuu
install -D gibuu/gibuu bin
install -D gibuu/release/objects/GiBUU.x bin
install -D gibuu/gibuu2lund bin
bin/GiBUU.x: lhapdf
$(MAKE) -C gibuu install

lhapdf:
lib/libLHAPDF.so:
$(eval V := 6.5.4)
wget https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${V}.tar.gz -O LHAPDF-${V}.tar.gz
tar -xzvf LHAPDF-${V}.tar.gz
cd LHAPDF-${V} && ./configure --prefix=${TOP}
cd LHAPDF-${V} && ./configure --prefix=${TOP} --disable-python
$(MAKE) -C LHAPDF-${V}
$(MAKE) -C LHAPDF-${V} install
rm -rf LHAPDF*

log4cpp:
lib/liblog4cpp.so:
wget https://sourceforge.net/projects/log4cpp/files/log4cpp-1.1.x%20%28new%29/log4cpp-1.1/log4cpp-1.1.4.tar.gz
tar -xzvf log4cpp-1.1.4.tar.gz
cd log4cpp && ./configure --prefix=${TOP}
$(MAKE) -C log4cpp
$(MAKE) -C log4cpp install
rm -rf log4cpp*

pythia6:
lib/libPythia6.so:
wget https://root.cern/download/pythia6.tar.gz
tar -xzvf pythia6.tar.gz
sed -i 's/^char /extern char /' ./pythia6/pythia6_common_address.c
sed -i 's/^int /extern int /' ./pythia6/pythia6_common_address.c
sed -i 's/^extern int pyuppr/int pyuppr /' ./pythia6/pythia6_common_address.c
cd pythia6 && ./makePythia6.linuxx8664
install -D pythia6/libPythia6.so lib
install -D pythia6/libPythia6.so lib/libPythia6.so

lib/libgsl.so:
wget https://ftp.gnu.org/gnu/gsl/gsl-2.7.tar.gz
tar -xzvf gsl-2.7.tar.gz
cd gsl-2.7 && ./configure --prefix=${TOP}
$(MAKE) -C gsl-2.7
$(MAKE) -C gsl-2.7 install

lib/libxml2.so:
wget http://mirror.umd.edu/gnome/sources/libxml2/2.11/libxml2-2.11.0.tar.xz
tar -xJvf libxml2-2.11.0.tar.xz
cd libxml2-2.11.0 && ./configure --prefix=${TOP} --without-python
$(MAKE) -C libxml2-2.11.0
$(MAKE) -C libxml2-2.11.0 install

root: pythia6
$(eval V := 6.30.04)
wget https://root.cern/download/root_v${V}.source.tar.gz
tar xzf root_v${V}.source.tar.gz
+ cmake -S root-${V} -B root-${V}-build \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_INSTALL_PREFIX=${TOP}/root \
-Dbuiltin_glew=ON \
-Dmathmore=ON \
-Dfftw3=ON \
-Dpythia6=ON \
-DPYTHIA6_LIBRARY=${TOP}/lib/libPythia6.so
+ cmake --build root-${V}-build --target install

genie: pythia6 lhapdf log4cpp
git clone -b R-3_04_00 --depth 1 https://github.com/GENIE-MC/Generator.git genie
cd genie && ./configure \
--prefix=${TOP} --disable-profiler --disable-validation-tools \
--disable-doxygen --disable-cernlib --disable-lhapdf5 --enable-lhapdf6 \
--enable-flux-drivers --enable-geom-drivers --enable-dylibversion --enable-nucleon-decay \
--enable-test --enable-mueloss --enable-t2k --enable-fnal --enable-atmo \
--disable-masterclass --disable-debug --with-optimiz-level=O2 \
--with-pythia6-lib=${TOP}/lib --with-lhapdf6-inc=${TOP}/include --with-lhapdf6-lib=${TOP}/lib \
--with-log4cpp-inc=${TOP}/include --with-log4cpp-lib=${TOP}/lib
$(MAKE) -C genie
$(MAKE) -C genie install
mv -f bin/genie bin/genie.exe
$(MAKE) -C genie-util install

install:
install -D clasdis/clasdis bin/clasdis
install -D claspyth/claspyth bin/claspyth
install -D dvcsgen/dvcsgen bin/dvcsgen
install -D genKYandOnePion/genKYandOnePion bin/genKYandOnePion
install -D inclusive-dis-rad/inclusive-dis-rad bin/inclusive-dis-rad
install -D JPsiGen/JPsiGen.exe bin/JPsiGen.exe
install -D JPsiGen/JPsiGen bin/JPsiGen
install -D twopeg/twopeg bin/twopeg
install -D JPsiGen/lib/libJPsiGen.so lib/libJPsiGen.so
install -D TCSGen/TCSGen.exe bin/TCSGen.exe
install -D TCSGen/TCSGen bin/TCSGen
install -D TCSGen/lib/libTCSGen.so lib/libTCSGen.so
install -D MCEGENpiN_radcorr/MCEGENpiN_radcorr bin/MCEGENpiN_radcorr
install -D deep-pipi-gen/deep-pipi-gen bin/deep-pipi-gen
install -D genepi/genepi bin/genepi
install -D generate-seeds.py bin/generate-seeds.py
install -D onepigen/onepigen bin/onepigen
install -D onepigen/onepigen_lund bin/onepigen_lund
install -D clas12-elSpectro/elSpectro/jpacPhoto/lib/* lib

clean:
rm -rf bin lib lib64 build share include etc
for dir in $(CLEANDIRS); do\
$(MAKE) -C $$dir clean; \
done
rm -rf LHAPDF* log4cpp* pythia6* libxml* root-* build

prune:
rm -rf LHAPDF* log4cpp* pythia6* libxml* root-* build

debug:
@ echo SUBMODULES: $(SUBMODULES)
@ echo CLEANDIRS: $(CLEANDIRS)
@ echo MAKEDIRS: $(MAKEDIRS)

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ name | description
[deep-pipi-gen] | Deep double pion production | Dilini Bulumulla
[genepi] | Photon and meson electroproduction | Noémie Pilleuxi
[onepigen] | Single charged pion production based on AO/Daresbury/MAID | Nick Tyler
[GiBUU] | |
[GENIE] | not supported on OSG yet, pending configuration wrapper script and LUND output |
[GiBUU] | | Ahmed El Alaoui
[GENIE] | Not ready for OSG |

# Adding or Modifying a Generator

Expand Down Expand Up @@ -74,6 +74,8 @@ clas12-elSpectro | :white_check_mark: | :white_check_mark: | :white_check_mark:
MCEGENpiN_radcorr | :white_check_mark: | :white_check_mark: | :white_check_mark: |
deep-pipi-gen | :white_check_mark: | :white_check_mark: | :white_check_mark: |
genepi | :white_check_mark: | :white_check_mark: | :white_check_mark: |
gibuu | :white_check_mark: | :white_check_mark: | :white_check_mark: |
genie | :white_check_mark: | :white_check_mark: | :white_check_mark: |

# Maintanance

Expand Down Expand Up @@ -168,6 +170,6 @@ git rm -f path/to/submodule
[deep-pipi-gen]: https://github.com/jeffersonlab/deep-pipi-gen
[genepi]: https://github.com/N-Plx/genepi
[onepigen]: https://github.com/tylern4/onepigen
[GENIE]: https://github.com/GENIE-MC/Generator
[GENIE]: https://github.com/jeffersonlab/clas12-mcgen/genie-util
[GiBUU]: https://github.com/jeffersonlab/clas12-mcgen/gibuu

1 change: 1 addition & 0 deletions genie-util/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
genie2lund
14 changes: 14 additions & 0 deletions genie-util/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

ROOT_CFLAGS := $(shell root-config --cflags)
ROOT_LIBS := $(shell root-config --libs)

install: build
install -D genie2lund ../bin
install -D genie ../bin

build:
$(CXX) $(ROOT_CFLAGS) -o genie2lund genie2lund.cxx $(ROOT_LIBS)

clean:
rm -f genie2lund

6 changes: 5 additions & 1 deletion genie/README.md → genie-util/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Just a recipe for building GENIE.
A recipe for building genie (moved to Makefile one up) plus a clas12 wrapper script and LUND converter.

See https://github.com/GENIE-MC/Generator

# A recipe for building GENIE.

## Prerequesites
1. GSL, not included because it seems to be standard in package managers, e.g., `yum install gsl-devel`, and a local install caused issues with ROOT's XRootD build
Expand Down
2 changes: 1 addition & 1 deletion genie/genie.py → genie-util/genie
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def convert_to_lund(opt):
cmd = 'genie2lund %s %s'%(opt.gntp,opt.lund)
return run_command(cmd.split(), opt.dryrun)

example = 'genie.py --trig 125 --probe 11 --target 1000010020 --energy 11.1'
example = 'genie --trig 125 --probe 11 --target 1000010020 --energy 11.1'

cli = argparse.ArgumentParser(description='Run all genie event generator steps, ending with LUND output.',epilog='For example, \"%s\"'%example)
cli.add_argument('--trig',metavar='#',help='number of events',type=int,required=True)
Expand Down
File renamed without changes.
6 changes: 0 additions & 6 deletions genie/.gitignore

This file was deleted.

25 changes: 0 additions & 25 deletions genie/Makefile

This file was deleted.

72 changes: 0 additions & 72 deletions genie/build-deps.sh

This file was deleted.

Loading

0 comments on commit b90b61e

Please sign in to comment.