From 95b9875e959f838752f500aa89329c9241bc6c7c Mon Sep 17 00:00:00 2001 From: Glenn Johnson Date: Mon, 19 Oct 2020 16:07:47 -0500 Subject: New package - Gate (#19377) * New package - Gate This PR adds the Gate package as well as the ITK dependency. * Fix flake 8 errors * Be more explicit with CMake options Make sure Cmake values related to variants are explicitly set to either ON/OFF. The ITK_USE_MKL flag will turn on the following: - USE_FFTWD=ON - USE_FFTWF=ON - USE_SYSTEM_FFTW=ON Since the package depends on fftw-api, those options will always be set. --- .../gate/cluster_tools_filemerger_Makefile.patch | 16 + .../gate/cluster_tools_jobsplitter_Makefile.patch | 33 ++ .../gate/cluster_tools_jobsplitter_platform.patch | 336 +++++++++++++++++++++ var/spack/repos/builtin/packages/gate/package.py | 87 ++++++ var/spack/repos/builtin/packages/itk/package.py | 84 ++++++ 5 files changed, 556 insertions(+) create mode 100644 var/spack/repos/builtin/packages/gate/cluster_tools_filemerger_Makefile.patch create mode 100644 var/spack/repos/builtin/packages/gate/cluster_tools_jobsplitter_Makefile.patch create mode 100644 var/spack/repos/builtin/packages/gate/cluster_tools_jobsplitter_platform.patch create mode 100644 var/spack/repos/builtin/packages/gate/package.py create mode 100644 var/spack/repos/builtin/packages/itk/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/gate/cluster_tools_filemerger_Makefile.patch b/var/spack/repos/builtin/packages/gate/cluster_tools_filemerger_Makefile.patch new file mode 100644 index 0000000000..8fc491f21d --- /dev/null +++ b/var/spack/repos/builtin/packages/gate/cluster_tools_filemerger_Makefile.patch @@ -0,0 +1,16 @@ +Common subdirectories: a/cluster_tools/filemerger/include and b/cluster_tools/filemerger/include +diff -u a/cluster_tools/filemerger/Makefile b/cluster_tools/filemerger/Makefile +--- a/cluster_tools/filemerger/Makefile 2020-03-25 04:30:34.000000000 -0500 ++++ b/cluster_tools/filemerger/Makefile 2020-10-10 14:52:07.181712970 -0500 +@@ -49,8 +49,8 @@ + + install: + @echo Installing ... +- @$(CP) $(TARGET) /usr/local/bin ++ @$(CP) $(TARGET) $(PREFIX)/bin + + uninstall: + @echo Uninstalling... +- @$(RM) /usr/local/bin/$(TARGET) ++ @$(RM) $(PREFIX)/bin/$(TARGET) +Common subdirectories: a/cluster_tools/filemerger/src and b/cluster_tools/filemerger/src diff --git a/var/spack/repos/builtin/packages/gate/cluster_tools_jobsplitter_Makefile.patch b/var/spack/repos/builtin/packages/gate/cluster_tools_jobsplitter_Makefile.patch new file mode 100644 index 0000000000..291b3a9d03 --- /dev/null +++ b/var/spack/repos/builtin/packages/gate/cluster_tools_jobsplitter_Makefile.patch @@ -0,0 +1,33 @@ +--- a/cluster_tools/jobsplitter/Makefile 2020-03-25 04:30:34.000000000 -0500 ++++ b/cluster_tools/jobsplitter/Makefile 2020-10-10 15:08:33.435073993 -0500 +@@ -4,6 +4,10 @@ + CP := cp + RM := rm -rf + ++ifndef GC_DEFAULT_PLATFORM ++$(error GC_DEFAULT_PLATFORM must be set) ++endif ++ + MAINSOURCES := $(wildcard *.cc) + SOURCES := $(wildcard ./src/*.cc) + MAINOBJECTS := $(patsubst %.cc, tmp/%.o, $(notdir $(MAINSOURCES))) +@@ -12,7 +16,7 @@ + vpath %.hh ./include + vpath %.cc ./src + +-CXXFLAGS := -DGC_DEFAULT_PLATFORM=\"condor\" ++CXXFLAGS := -DGC_DEFAULT_PLATFORM=\"$(GC_DEFAULT_PLATFORM)\" + INCLUDE := -I./include `geant4-config --cflags` + LDFLAGS := `geant4-config --libs` + +@@ -57,8 +61,8 @@ + + install: + @echo Installing ... +- @$(CP) $(TARGET) /usr/local/bin ++ @$(CP) $(TARGET) $(PREFIX)/bin + + uninstall: + @echo Uninstalling... +- @$(RM) /usr/local/bin/$(TARGET) ++ @$(RM) $(PREFIX)/bin/$(TARGET) diff --git a/var/spack/repos/builtin/packages/gate/cluster_tools_jobsplitter_platform.patch b/var/spack/repos/builtin/packages/gate/cluster_tools_jobsplitter_platform.patch new file mode 100644 index 0000000000..3662fdfeee --- /dev/null +++ b/var/spack/repos/builtin/packages/gate/cluster_tools_jobsplitter_platform.patch @@ -0,0 +1,336 @@ +diff -ru a/cluster_tools/jobsplitter/gjs.cc b/cluster_tools/jobsplitter/gjs.cc +--- a/cluster_tools/jobsplitter/gjs.cc 2020-03-25 04:30:34.000000000 -0500 ++++ b/cluster_tools/jobsplitter/gjs.cc 2020-10-10 21:01:14.376770641 -0500 +@@ -30,15 +30,18 @@ + cout<<" -a value alias : use any alias"<1&&pbsscript!="")cout<<"Information : using $GC_PBS_SCRIPT="<1&&slurmscript!="")cout<<"Information : using $GC_SLURM_SCRIPT="<1&&sgescript!="")cout<<"Information : using $GC_SGE_SCRIPT="<1&&condorscript!="")cout<<"Information : using $GC_CONDOR_SCRIPT="<0)cout<<"Warning : cluster platform is not openPBS, openPBSscript ignored!"<0)cout<<"Warning : cluster platform is not slurm, slurmscript ignored!"<0)cout<<"Warning : cluster platform is not SGE, sgescript ignored!"<1)cout<<"Information : using "<SetVerboseLevel(verb); + manager->StartSplitting(); + +diff -ru a/cluster_tools/jobsplitter/include/GateSplitManager.hh b/cluster_tools/jobsplitter/include/GateSplitManager.hh +--- a/cluster_tools/jobsplitter/include/GateSplitManager.hh 2020-03-25 04:30:34.000000000 -0500 ++++ b/cluster_tools/jobsplitter/include/GateSplitManager.hh 2020-10-10 21:02:25.136728953 -0500 +@@ -21,7 +21,7 @@ + { + public: + +- GateSplitManager(G4int nAliases,G4String* aliases,G4String platform,G4String pbsscript,G4String slurmscript,G4String condorscript,G4String macfile,G4int nSplits,G4int time); ++ GateSplitManager(G4int nAliases,G4String* aliases,G4String platform,G4String pbsscript,G4String slurmscript,G4String sgescript,G4String condorscript,G4String macfile,G4int nSplits,G4int time); + ~GateSplitManager(); + void SetVerboseLevel(G4int value) { m_verboseLevel = value; }; + void StartSplitting(); +diff -ru a/cluster_tools/jobsplitter/include/GateToPlatform.hh b/cluster_tools/jobsplitter/include/GateToPlatform.hh +--- a/cluster_tools/jobsplitter/include/GateToPlatform.hh 2020-03-25 04:30:34.000000000 -0500 ++++ b/cluster_tools/jobsplitter/include/GateToPlatform.hh 2020-10-10 21:11:45.910390030 -0500 +@@ -20,7 +20,7 @@ + { + public: + GateToPlatform(); +- GateToPlatform(G4int numberOfSplits, G4String thePlatform, G4String pbsscript,G4String slurmscript,G4String theCondorScript,G4String outputMacName,G4int time); ++ GateToPlatform(G4int numberOfSplits, G4String thePlatform, G4String pbsscript,G4String slurmscript,G4String sgescript,G4String theCondorScript,G4String outputMacName,G4int time); + ~GateToPlatform(); + void SetVerboseLevel(G4int value) { m_verboseLevel = value; }; + int GenerateSubmitfile(G4String outputMacDir); +@@ -31,6 +31,8 @@ + int GenerateOpenPBSScriptfile(); + int GenerateSlurmSubmitfile(); + int GenerateSlurmScriptfile(); ++ int GenerateSGESubmitfile(); ++ int GenerateSGEScriptfile(); + int GenerateCondorSubmitfile(); + int GenerateXgridSubmitfile(); + G4int m_verboseLevel; +@@ -38,6 +40,7 @@ + G4String platform; + G4String pbsScript; + G4String slurmScript; ++ G4String sgeScript; + G4String condorScript; + G4String outputMacfilename; + G4String outputDir; +Only in b/cluster_tools/jobsplitter/script: SGE.script +diff -ru a/cluster_tools/jobsplitter/src/GateSplitManager.cc b/cluster_tools/jobsplitter/src/GateSplitManager.cc +--- a/cluster_tools/jobsplitter/src/GateSplitManager.cc 2020-03-25 04:30:34.000000000 -0500 ++++ b/cluster_tools/jobsplitter/src/GateSplitManager.cc 2020-10-10 21:15:14.371255628 -0500 +@@ -17,9 +17,10 @@ + using std::endl; + + GateSplitManager::GateSplitManager(G4int nAliases,G4String* aliases,G4String platform,G4String pbsscript, +- G4String slurmscript,G4String condorscript,G4String macfile,G4int nSplits,G4int time) ++ G4String slurmscript,G4String sgescript,G4String condorscript, ++ G4String macfile,G4int nSplits,G4int time) + { +- toPlatform = new GateToPlatform(nSplits,platform,pbsscript,slurmscript,condorscript,macfile,time); ++ toPlatform = new GateToPlatform(nSplits,platform,pbsscript,slurmscript,sgescript,condorscript,macfile,time); + macParser = new GateMacfileParser(macfile,nSplits,nAliases,aliases); + numberOfSplits=nSplits; + } +diff -ru a/cluster_tools/jobsplitter/src/GateToPlatform.cc b/cluster_tools/jobsplitter/src/GateToPlatform.cc +--- a/cluster_tools/jobsplitter/src/GateToPlatform.cc 2020-03-25 04:30:34.000000000 -0500 ++++ b/cluster_tools/jobsplitter/src/GateToPlatform.cc 2020-10-10 22:04:46.108197968 -0500 +@@ -25,12 +25,13 @@ + using std::ifstream; + using std::ostringstream; + +-GateToPlatform::GateToPlatform(G4int numberOfSplits, G4String thePlatform, G4String thePbsscript, G4String theSlurmScript, G4String theCondorScript, G4String outputMacName, G4int time) ++GateToPlatform::GateToPlatform(G4int numberOfSplits, G4String thePlatform, G4String thePbsScript, G4String theSlurmScript, G4String theSgeScript,G4String theCondorScript, G4String outputMacName, G4int time) + { + nSplits=numberOfSplits; + platform=thePlatform; +- pbsScript=thePbsscript; ++ pbsScript=thePbsScript; + slurmScript=theSlurmScript; ++ sgeScript=theSgeScript; + condorScript=theCondorScript; + useTiming=time; + outputMacfilename=outputMacName.substr(0,outputMacName.length()-4); +@@ -60,6 +61,11 @@ + err+=GenerateSlurmSubmitfile(); + if (err>0) return 1; + } ++ if (platform=="SGE"){ ++ err+=GenerateSGEScriptfile(); ++ err+=GenerateSGESubmitfile(); ++ if (err>0) return 1; ++ } + if (platform=="condor"){ + err+=GenerateCondorSubmitfile(); + if (err>0) return 1; +@@ -262,6 +268,111 @@ + } + submitFile.close(); + chmod( submitFilename.c_str() , S_IRWXU|S_IRGRP ); ++ return 0; ++} ++ ++int GateToPlatform::GenerateSGEScriptfile() ++{ ++ G4String queue=""; ++ if (!getenv("GC_SGE_QUEUE")) { ++ queue="all.q"; ++ } else { ++ queue=getenv("GC_SGE_QUEUE"); ++ } ++ ++ G4String dir=getenv("GC_GATE_EXE_DIR"); ++ if (dir.substr(dir.length()-1,dir.length())!="/") dir=dir+"/"; ++ ++ //check if we have an existing directory ++ ifstream dirstream(dir.c_str()); ++ if (!dirstream) { ++ cout<<"Error : Failed to detect the Gate executable directory"<