Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added geant4 and root #19

Merged
merged 11 commits into from Jan 2, 2013

Conversation

Projects
None yet
3 participants
Contributor

JensTimmerman commented Nov 8, 2012

No description provided.

@itkovian itkovian commented on an outdated diff Nov 8, 2012

easybuild/easyblocks/g/geant4.py
@@ -0,0 +1,344 @@
+##
+# Copyright 2009-2012 Stijn De Weirdt
@itkovian

itkovian Nov 8, 2012

Contributor

Include

Copyright 2009-2012 Ghent University

@itkovian itkovian commented on an outdated diff Nov 8, 2012

easybuild/easyblocks/g/geant4.py
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation v2.
+#
+# EasyBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
+##
+"""
+Geant4 support, implemented as an easyblock.
+"""
+
+import os, shutil, re
@itkovian

itkovian Nov 8, 2012

Contributor

One import per line

boegel and others added some commits Nov 27, 2012

Contributor

JensTimmerman commented Nov 29, 2012

Should be fixed.

@itkovian itkovian commented on an outdated diff Nov 29, 2012

easybuild/easyblocks/g/geant4.py
+ ]
+ return ConfigureMake.extra_options(extra_vars)
+
+ def configure_step(self):
+ """
+ Configure Geant4 build, either via CMake for versions more recent than 9.5,
+ or using an interactive configuration procedure otherwise.
+ """
+
+ # Geant4 switched to a cmake build system in 9.5
+ if LooseVersion(self.get_installversion()) >= LooseVersion("9.5"):
+ #elif not os.path.isdir(builddir):
+ mkdir('configdir')
+ os.chdir('configdir')
+ CMakeMake.configure(self, builddir="..")
+
@itkovian

itkovian Nov 29, 2012

Contributor

remove empty line, unless you think this looks superb as it is.

@itkovian itkovian commented on an outdated diff Nov 29, 2012

easybuild/easyblocks/g/geant4.py
+ self.qanda = {# questions and answers for version 9.1.p03
+ "There exists a config.sh file. Shall I use it to set the defaults? [y]": "n",
+ "Would you like to see the instructions? [n]": "",
+ "[Type carriage return to continue]": "",
+ "Definition of G4SYSTEM variable is Linux-g++. That stands for: 1) OS : Linux 2) Compiler : g++ To modify default settings, select number above (e.g. 2) [Press [Enter] for default settings]": "2",
+ "Which C++ compiler? [g++]": "$(GPP)",
+ "Confirm your selection or set recommended 'g++'! [*]": "",
+ "Definition of G4SYSTEM variable is Linux-icc. That stands for: 1) OS : Linux 2) Compiler : icc To modify default settings, select number above (e.g. 2) [Press [Enter] for default settings]": "",
+ "Do you expect to run these scripts and binaries on multiple machines? [n]": "y",
+ "Where is Geant4 source installed? [%s]" % pwd: "",
+ "Specify the path where Geant4 libraries and source files should be installed. [%s]" % pwd: dst,
+ "Do you want to copy all Geant4 headers in one directory? [n]": "y",
+ "Please, specify default directory where ALL the Geant4 data is installed: G4LEVELGAMMADATA: %(pwd)s/data/PhotonEvaporation2.0 G4RADIOACTIVEDATA: %(pwd)s/data/RadioactiveDecay3.2 G4LEDATA: %(pwd)s/data/G4EMLOW5.1 G4NEUTRONHPDATA: %(pwd)s/data/G4NDL3.12 G4ABLADATA: %(pwd)s/data/G4ABLA3.0 You will be asked about customizing these next. [%(pwd)s/data]" % {'pwd':pwd}: "%s/data" % dst,
+ "Directory %s/data doesn't exist. Use that name anyway? [n]" % dst: "y",
+ "Please, specify default directory where the Geant4 data is installed: 1) G4LEVELGAMMADATA: %(dst)s/data/PhotonEvaporation2.0 2) G4RADIOACTIVEDATA: %(dst)s/data/RadioactiveDecay3.2 3) G4LEDATA: %(dst)s/data/G4EMLOW5.1 4) G4NEUTRONHPDATA: %(dst)s/data/G4NDL3.12 5) G4ABLADATA: %(dst)s/data/G4ABLA3.0 To modify default settings, select number above (e.g. 2) [Press [Enter] for default settings]" % {'dst':dst}: "",
+ "Please, specify where CLHEP is installed: CLHEP_BASE_DIR: ":clhepdir,
@itkovian

itkovian Nov 29, 2012

Contributor

Space after : (pep8)

@itkovian itkovian commented on an outdated diff Nov 29, 2012

easybuild/easyblocks/g/geant4.py
+ clhepdir = get_software_root('CLHEP')
+ cmd = "%s/Configure -E -build" % pwd
+
+ self.qanda = {# questions and answers for version 9.1.p03
+ "There exists a config.sh file. Shall I use it to set the defaults? [y]": "n",
+ "Would you like to see the instructions? [n]": "",
+ "[Type carriage return to continue]": "",
+ "Definition of G4SYSTEM variable is Linux-g++. That stands for: 1) OS : Linux 2) Compiler : g++ To modify default settings, select number above (e.g. 2) [Press [Enter] for default settings]": "2",
+ "Which C++ compiler? [g++]": "$(GPP)",
+ "Confirm your selection or set recommended 'g++'! [*]": "",
+ "Definition of G4SYSTEM variable is Linux-icc. That stands for: 1) OS : Linux 2) Compiler : icc To modify default settings, select number above (e.g. 2) [Press [Enter] for default settings]": "",
+ "Do you expect to run these scripts and binaries on multiple machines? [n]": "y",
+ "Where is Geant4 source installed? [%s]" % pwd: "",
+ "Specify the path where Geant4 libraries and source files should be installed. [%s]" % pwd: dst,
+ "Do you want to copy all Geant4 headers in one directory? [n]": "y",
+ "Please, specify default directory where ALL the Geant4 data is installed: G4LEVELGAMMADATA: %(pwd)s/data/PhotonEvaporation2.0 G4RADIOACTIVEDATA: %(pwd)s/data/RadioactiveDecay3.2 G4LEDATA: %(pwd)s/data/G4EMLOW5.1 G4NEUTRONHPDATA: %(pwd)s/data/G4NDL3.12 G4ABLADATA: %(pwd)s/data/G4ABLA3.0 You will be asked about customizing these next. [%(pwd)s/data]" % {'pwd':pwd}: "%s/data" % dst,
@itkovian

itkovian Nov 29, 2012

Contributor

This line is too long, but you already knew that :)

@itkovian itkovian commented on an outdated diff Nov 29, 2012

easybuild/easyblocks/g/geant4.py
+ shutil.copy2(os.path.join(self.scriptdir, fil), os.path.join(self.installdir, fil))
+ except IOError, err:
+ self.log.error("Something went wrong during copying of (%s) to %s: %s" % (fil, self.installdir, err))
+
+ cmd = "%(pwd)s/Configure -f %(pwd)s/config.sh -d -install" % {'pwd':pwd}
+ run_cmd(cmd, log_all=True, simple=True)
+
+ mpiuidir = os.path.join(self.installdir, "examples/extended/parallel/MPI/mpi_interface")
+ os.chdir(mpiuidir)
+
+ # tweak config file as needed
+ f = open("G4MPI.gmk", "r")
+ G4MPItxt = f.read()
+ f.close()
+
+ r = re.compile("(.*G4MPIROOT\s+=\s+).*", re.MULTILINE)
@itkovian

itkovian Nov 29, 2012

Contributor

How about using meaningful names?

@itkovian itkovian and 1 other commented on an outdated diff Nov 29, 2012

easybuild/easyblocks/g/geant4.py
+ # make sure the required environment variables are there
+ os.putenv("G4INSTALL", self.installdir)
+ os.putenv("G4SYSTEM", self.g4system)
+ os.putenv("G4LIB", "%s/lib/geant4/" % self.installdir)
+ os.putenv("G4INCLUDE", "%s/include/geant4/" % self.installdir)
+
+ run_cmd("make", log_all=True, simple=True)
+ run_cmd("make includes", log_all=True, simple=True)
+
+ def make_module_extra(self):
+ """Define Geant4-specific environment variables in module file."""
+ g4version = '.'.join(self.get_version().split('.')[:2])
+
+ txt = ConfigureMake.make_module_extra(self)
+ txt += "setenv\tG4INSTALL\t\t$root\n"
+ #no longer needed in > 9.5, but leave it there for now.
@itkovian

itkovian Nov 29, 2012

Contributor

Why? Might break future versions?

@JensTimmerman

JensTimmerman Nov 29, 2012

Contributor

some people might be using this in scripts.

@JensTimmerman

JensTimmerman Nov 29, 2012

Contributor

but actually I should use modulegenerator everywhere.

@itkovian itkovian and 2 others commented on an outdated diff Nov 29, 2012

easybuild/easyblocks/g/geant4.py
+ txt += "setenv\tG4LEDATA\t%s/G4EMLOW%s\n" % (self.datadst, self.getcfg('G4EMLOWVersion'))
+ txt += "setenv\tG4NEUTRONHPDATA\t%s/G4NDL%s\n" % (self.datadst, self.getcfg('G4NDLVersion'))
+
+ return txt
+
+ def sanity_check_step(self):
+ """
+ Custom sanity check for Geant4 >= 9.5
+ Not tested with previous versions
+ """
+ custom_paths = {
+ 'files': ["bin/geant4.sh",
+ "bin/geant4.csh",
+ "bin/geant4-config",
+ ] + ["lib64/%s" % x for x in [
+ 'libG4analysis.so',
@itkovian

itkovian Nov 29, 2012

Contributor

Indentation, indentation, indentation. It sucks like this.

@JensTimmerman

JensTimmerman Dec 11, 2012

Contributor

I agree, But this is how kenneth likes it...

@boegel

boegel Dec 11, 2012

Owner

Well, I would do something like:

custom_paths = {
                'files': ["bin/geant4%s" % x for x in [".sh", ".csh", "-config"] +
                         ["lib64/libG4%s.so" % x for x in ['analysis', 'event', 'GMocren', 'materials',
                                                           'persistency', 'readout', 'Tree', 'VRML']],
                'dirs': ['include/Geant4'],
               }

@itkovian itkovian and 1 other commented on an outdated diff Nov 29, 2012

easybuild/easyblocks/r/root.py
@@ -0,0 +1,43 @@
+##
+# Copyright 2012 Kenneth Hoste
@itkovian

itkovian Nov 29, 2012

Contributor

Add Ghent University line, and add yourself, if this comes from you.

@boegel

boegel Dec 11, 2012

Owner

Actually, we need to remove all personal copyright lines, there should only be one for UGent.

Authors should be listed in another way, together with a maintainer (see hpcugent/easybuild-framework#334).

Owner

boegel commented Dec 28, 2012

I created a pull request that should resolve the remarks, and also fix a couple of problems I ran into when testing these easyblocks, see JensTimmerman#1.

@JensTimmerman JensTimmerman Merge pull request #1 from boegel/gate
fixed easyblocks for Geant4 and ROOT
b4fcc44

@boegel boegel added a commit that referenced this pull request Jan 2, 2013

@boegel boegel Merge pull request #19 from JensTimmerman/gate
Added geant4 and root
0cf85d1

@boegel boegel merged commit 0cf85d1 into easybuilders:develop Jan 2, 2013

@JensTimmerman JensTimmerman deleted the JensTimmerman:gate branch Jan 3, 2013

@boegel boegel pushed a commit to boegel/easybuild-easyblocks that referenced this pull request Dec 14, 2015

@wpoely86 wpoely86 Merge pull request #19 from boegel/intelstuff
sync with develop
f95c94e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment