diff options
5 files changed, 556 insertions, 0 deletions
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"<<endl; + cout<<" -numberofsplits, -n n : the number of job splits; default=1"<<endl; + cout<<" -clusterplatform, -c name : the cluster platform, name is one of the following:"<<endl; +- cout<<" openmosix - condor - openPBS - slurm - xgrid"<<endl; ++ cout<<" openmosix - condor - openPBS - slurm - xgrid - SGE"<<endl; + cout<<" This executable is compiled with "<<GC_DEFAULT_PLATFORM<<" as default"<<endl<<endl; +- cout<<" -openPBSscript, os : template for an openPBS script "<<endl; ++ cout<<" -openPBSscript, os script : template for an openPBS script "<<endl; + cout<<" see the example that comes with the source code (script/openPBS.script)"<<endl; + cout<<" overrules the environment variable below"<<endl<<endl; +- cout<<" -slurmscript, ss : template for a SLURM script "<<endl; ++ cout<<" -slurmscript, ss script : template for a SLURM script "<<endl; + cout<<" see the example that comes with the source code (script/slurm.script)"<<endl; + cout<<" overrules the environment variable below"<<endl<<endl; +- cout<<" -condorscript, cs : template for a condor submit file"<<endl; ++ cout<<" -SGEscript, gs script : template for a SGE script "<<endl; ++ cout<<" see the example that comes with the source code (script/SGE.script)"<<endl; ++ cout<<" overrules the environment variable below"<<endl<<endl; ++ cout<<" -condorscript, cs script : template for a condor submit file"<<endl; + cout<<" see the example that comes with the source code (script/condor.script)"<<endl; + cout<<" -v : verbosity 0 1 2 3 - 1 default "<<endl; + cout<<endl; +@@ -46,6 +49,10 @@ + cout<<" GC_DOT_GATE_DIR : indicates the .Gate directory for splitted mac files"<<endl; + cout<<" GC_GATE_EXE_DIR : indicates the directory with the Gate executable"<<endl; + cout<<" GC_PBS_SCRIPT : the openPBS template script (!optionnal variable!)"<<endl; ++ cout<<" GC_SLURM_SCRIPT : the Slurm template script (!optionnal variable!)"<<endl; ++ cout<<" GC_SGE_SCRIPT : the SGE template script (!optionnal variable!)"<<endl; ++ cout<<" GC_CONDOR_SCRIPT : the condor template script (!optionnal variable!)"<<endl; ++ cout<<" GC_SGE_QUEUE : the SGE queue to use, defaults to all.q if unset (!optional variable!)"<<endl; + cout<<endl; + cout<<" Usage (bash):"<<endl; + cout<<" export GC_DOT_GATE_DIR=/home/user/gatedir/"<<endl; +@@ -55,6 +62,9 @@ + cout<<" gjs -numberofsplits 10 -clusterplatform openmosix macro.mac"<<endl; + cout<<" gjs -numberofsplits 10 -clusterplatform openmosix -a /somedir/rootfilename ROOT_FILE macro.mac"<<endl<<endl; + cout<<" gjs -numberofsplits 10 -clusterplatform openPBS -openPBSscript /somedir/script macro.mac"<<endl<<endl; ++ cout<<" gjs -numberofsplits 10 -clusterplatform slurm -slurmscript /somedir/script macro.mac"<<endl<<endl; ++ cout<<" gjs -numberofsplits 10 -clusterplatform SGE -SGEscript /somedir/script macro.mac"<<endl<<endl; ++ cout<<" gjs -numberofsplits 10 -clusterplatform condor -condorscript /somedir/script macro.mac"<<endl<<endl; + cout<<" gjs -numberofsplits 10 -clusterplatform xgrid macro.mac"<<endl<<endl; + cout<<" gjs -numberofsplits 10 /somedir/script macro.mac"<<endl<<endl; + exit(0); +@@ -67,6 +77,7 @@ + G4String macfile; + G4String pbsscript; + G4String slurmscript; ++ G4String sgescript; + G4String condorscript; + G4int nSplits=0; + G4int nextArg = 1; +@@ -131,6 +142,12 @@ + slurmscript=argv[nextArg+1]; + if(debug)cout<<"found -slurmscript "<<slurmscript<<endl; + } ++ if ((!strcmp(argv[nextArg],"-SGEscript") || !strcmp(argv[nextArg],"-gs")) && indicator==0) ++ { ++ indicator=1; ++ sgescript=argv[nextArg+1]; ++ if(debug)cout<<"found -SGEscript "<<sgescript<<endl; ++ } + if ((!strcmp(argv[nextArg],"-condorscript") || !strcmp(argv[nextArg],"-cs")) && indicator==0) + { + indicator=1; +@@ -168,7 +185,7 @@ + } + } + +- if (platform=="" || platform=="openmosix" || platform=="openPBS" || platform=="slurm" || platform=="condor"|| platform=="xgrid") ++ if (platform=="" || platform=="openmosix" || platform=="openPBS" || platform=="slurm" || platform=="SGE" || platform=="condor"|| platform=="xgrid") + { + if (platform=="") + { +@@ -180,6 +197,21 @@ + pbsscript=getenv("GC_PBS_SCRIPT"); + if(verb>1&&pbsscript!="")cout<<"Information : using $GC_PBS_SCRIPT="<<pbsscript<<" as default PBS template script"<<endl; + }} ++ if (platform=="slurm"&&slurmscript==""){ ++ if (getenv("GC_SLURM_SCRIPT")){ ++ slurmscript=getenv("GC_SLURM_SCRIPT"); ++ if(verb>1&&slurmscript!="")cout<<"Information : using $GC_SLURM_SCRIPT="<<slurmscript<<" as default slurm template script"<<endl; ++ }} ++ if (platform=="SGE"&&sgescript==""){ ++ if (getenv("GC_SGE_SCRIPT")){ ++ sgescript=getenv("GC_SGE_SCRIPT"); ++ if(verb>1&&sgescript!="")cout<<"Information : using $GC_SGE_SCRIPT="<<sgescript<<" as default SGE template script"<<endl; ++ }} ++ if (platform=="condoe"&&condorscript==""){ ++ if (getenv("GC_CONDOR_SCRIPT")){ ++ condorscript=getenv("GC_CONDOR_SCRIPT"); ++ if(verb>1&&condorscript!="")cout<<"Information : using $GC_CONDOR_SCRIPT="<<condorscript<<" as default condor template script"<<endl; ++ }} + if (platform!="openPBS"&&pbsscript!="") + { + if(verb>0)cout<<"Warning : cluster platform is not openPBS, openPBSscript ignored!"<<endl; +@@ -189,7 +221,25 @@ + cout<<"Error : cluster platform is openPBS but openPBSscript undefined!"<<endl; + exit(1); + } +- if ((platform=="openPBS"&&pbsscript!="")||platform=="openmosix"||(platform=="condor"&&condorscript!="")) ++ if (platform!="slurm"&&slurmscript!="") ++ { ++ if(verb>0)cout<<"Warning : cluster platform is not slurm, slurmscript ignored!"<<endl; ++ } ++ if (platform=="slurm"&&slurmscript=="") ++ { ++ cout<<"Error : cluster platform is slurm but slurmscript undefined!"<<endl; ++ exit(1); ++ } ++ if (platform!="SGE"&&sgescript!="") ++ { ++ if(verb>0)cout<<"Warning : cluster platform is not SGE, sgescript ignored!"<<endl; ++ } ++ if (platform=="SGE"&&sgescript=="") ++ { ++ cout<<"Error : cluster platform is SGE but sgescript undefined!"<<endl; ++ exit(1); ++ } ++ if ((platform=="openPBS"&&pbsscript!="")||(platform=="slurm"&&slurmscript!="")||(platform=="SGE"&&sgescript!="")||platform=="openmosix"||(platform=="condor"&&condorscript!="")) + { + if(verb>1)cout<<"Information : using "<<platform<<" as cluster platform!"<<endl; + } +@@ -216,7 +266,7 @@ + } + //create a splitmanager to coordinate it all + GateSplitManager* manager; +- manager=new GateSplitManager(nAliases,aliases,platform,pbsscript,slurmscript,condorscript,macfile,nSplits,time); ++ manager=new GateSplitManager(nAliases,aliases,platform,pbsscript,slurmscript,sgescript,condorscript,macfile,nSplits,time); + manager->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"<<endl; ++ cout<<"Please check your environment variables!"<<endl; ++ cout<<"Generated submit file may be invalid..."<<endl; ++ return 1; ++ } ++ dirstream.close(); ++ ++ //create script file to be submitted with qsub (SGE) ++ ++ ++ char out_name[1000]; ++ G4String buf; ++ for (G4int i=1;i<=nSplits;i++) ++ { ++ ostringstream cnt; ++ cnt<<i; ++ // open template script file ++ ifstream inFile(sgeScript); ++ if (!inFile) { ++ cout<< "Error : could not access SGE script template file! "<<sgeScript<< endl; ++ return(1); ++ } ++ sprintf(out_name,"%s%i%s",outputDir.c_str(),i,".sge"); ++ ofstream scriptFile(out_name); ++ if (!scriptFile) { ++ cout<< "Error : could not create script file! "<<out_name<< endl; ++ return(1); ++ } ++ while(getline(inFile,buf)){ ++ if(buf.find("#")!=0||buf.find("#$")==0){ ++ unsigned int pos=buf.find("GC_WORKDIR"); ++ if(pos<buf.length()) buf=buf.substr(0,pos)+outputDir.substr(0,outputDir.rfind("/"))+buf.substr(pos+10); ++ pos=buf.find("GC_SGE_QUEUE"); ++ if(pos<buf.length()) buf=buf.substr(0,pos)+queue+buf.substr(pos+12); ++ pos=buf.find("GC_LOG"); ++ if(pos<buf.length()) buf=buf.substr(0,pos)+"log"+cnt.str()+buf.substr(pos+6); ++ pos=buf.find("GC_ERR"); ++ if(pos<buf.length()) buf=buf.substr(0,pos)+"err"+cnt.str()+buf.substr(pos+6); ++ pos=buf.find("GC_JOBNAME"); ++ if(pos<buf.length()) { ++ //SGE max_jobname_length=512 ++ char jobname[256]=""; ++ strncpy(jobname,outputMacfilename.c_str(),255-cnt.str().length()); ++ buf=buf.substr(0,pos)+jobname+cnt.str()+buf.substr(pos+10); ++ } ++ pos=buf.find("GC_GATE"); ++ G4String timestr=""; ++ if (useTiming==1) timestr="time "; ++ if(pos<buf.length()) buf=timestr+dir+"Gate "+outputDir+cnt.str()+".mac"+buf.substr(pos+7); ++ } ++ scriptFile<<buf<<endl; ++ } ++ scriptFile.close(); ++ inFile.close(); ++ } ++ return 0; ++} ++ ++int GateToPlatform::GenerateSGESubmitfile() ++{ ++ G4String dir=getenv("GC_GATE_EXE_DIR"); ++ if (dir.substr(dir.length()-1,dir.length())!="/") dir=dir+"/"; ++ ++ //check if we have an existing director ++ ifstream dirstream(dir.c_str()); ++ if (!dirstream) { ++ cout<<"Error : Failed to detect the Gate executable directory"<<endl; ++ cout<<"Please check your environment variables!"<<endl; ++ cout<<"Generated submit file may be invalid..."<<endl; ++ return 1; ++ } ++ dirstream.close(); ++ ++ G4String submitFilename=outputMacfilename+".submit"; ++ ofstream submitFile(submitFilename.c_str()); ++ if (!submitFile) { ++ cout<< "Error : could not create submit file! "<<submitFilename<< endl; ++ return(1); ++ } ++ submitFile<<"#! /bin/sh"<<endl; ++ for (G4int i=1;i<=nSplits;i++) ++ { ++ submitFile<<"echo qsub "<<outputDir<<i<<+".sge"<<endl; ++ submitFile<<"qsub "<<outputDir<<i<<+".sge"<<endl; ++ } ++ submitFile.close(); ++ chmod( submitFilename.c_str() , S_IRWXU|S_IRGRP ); + return 0; + } + diff --git a/var/spack/repos/builtin/packages/gate/package.py b/var/spack/repos/builtin/packages/gate/package.py new file mode 100644 index 0000000000..741d472f80 --- /dev/null +++ b/var/spack/repos/builtin/packages/gate/package.py @@ -0,0 +1,87 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Gate(CMakePackage): + """Simulations of Preclinical and Clinical Scans in Emission Tomography, + Transmission Tomography and Radiation Therapy + + GATE is an advanced opensource software developed by the international + OpenGATE collaboration and dedicated to numerical simulations in medical + imaging and radiotherapy. It currently supports simulations of Emission + Tomography (Positron Emission Tomography - PET and Single Photon Emission + Computed Tomography - SPECT), Computed Tomography (CT), Optical Imaging + (Bioluminescence and Fluorescence) and Radiotherapy experiments. Using an + easy-to-learn macro mechanism to configurate simple or highly sophisticated + experimental settings, GATE now plays a key role in the design of new + medical imaging devices, in the optimization of acquisition protocols and + in the development and assessment of image reconstruction algorithms and + correction techniques. It can also be used for dose calculation in + radiotherapy experiments.""" + + homepage = "http://opengatecollaboration.org/" + url = "https://github.com/OpenGATE/Gate/archive/v9.0.tar.gz" + + maintainers = ['glennpj'] + + version('9.0', sha256='8354f392facc0b7ae2ddf0eed61cc43136195b198ba399df25e874886b8b69cb') + + variant('rtk', default=False, + description='build support for the Reconstruction Toolkit') + variant('default_platform', default='condor', + description='select default platform for the cluster tools', + values=('SGE', 'condor', 'openPBS', 'openmosix', 'slurm', 'xgrid'), + multi=False) + + depends_on('geant4~threads') # Gate needs a non-threaded geant4 + depends_on('root') + depends_on('itk+rtk', when='+rtk') + + patch('cluster_tools_filemerger_Makefile.patch') + patch('cluster_tools_jobsplitter_Makefile.patch') + patch('cluster_tools_jobsplitter_platform.patch') + + def cmake_args(self): + args = [] + + if '+rtk' in self.spec: + args.append('-DGATE_USE_RTK=ON') + else: + args.append('-DGATE_USE_RTK=OFF') + + return args + + def setup_build_environment(self, env): + gc_default_platform = self.spec.variants['default_platform'].value + env.set('GC_DEFAULT_PLATFORM', gc_default_platform) + + def setup_run_environment(self, env): + env.set('GC_GATE_EXE_DIR', self.prefix.bin) + env.set('GC_CONDOR_SCRIPT', join_path(self.prefix, 'share', + 'jobsplitter', 'condor.script')) + env.set('GC_PBS_SCRIPT', join_path(self.prefix, 'share', + 'jobsplitter', 'openPBS.script')) + env.set('GC_SGE_SCRIPT', join_path(self.prefix, 'share', + 'jobsplitter', 'SGE.script')) + env.set('GC_SLURM_SCRIPT', join_path(self.prefix, 'share', + 'jobsplitter', 'slurm.script')) + + @run_after('install') + def cluster_tools(self): + with working_dir('cluster_tools/filemerger'): + make() + make('install', 'PREFIX={0}'.format(self.prefix)) + + with working_dir('cluster_tools/jobsplitter'): + make() + make('install', 'PREFIX={0}'.format(self.prefix)) + + script_path = join_path(self.prefix, 'share', 'jobsplitter') + mkdirp(script_path) + install_tree('cluster_tools/jobsplitter/script', script_path) + install('*.xml', self.prefix.share) + install('*.db', self.prefix.share) diff --git a/var/spack/repos/builtin/packages/itk/package.py b/var/spack/repos/builtin/packages/itk/package.py new file mode 100644 index 0000000000..ef0f129318 --- /dev/null +++ b/var/spack/repos/builtin/packages/itk/package.py @@ -0,0 +1,84 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Itk(CMakePackage): + """The Insight Toolkit (ITK) is an open-source, cross-platform toolkit for + N-dimensional scientific image processing, segmentation, and registration. + + The Insight Toolkit (ITK) is an open-source, cross-platform toolkit for + N-dimensional scientific image processing, segmentation, and registration. + Segmentation is the process of identifying and classifying data found in a + digitally sampled representation. Typically the sampled representation is + an image acquired from such medical instrumentation as CT or MRI scanners. + Registration is the task of aligning or developing correspondences between + data. For example, in the medical environment, a CT scan may be aligned + with a MRI scan in order to combine the information contained in both.""" + + homepage = "https://itk.org/" + url = "https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.1/InsightToolkit-5.1.1.tar.gz" + + maintainers = ['glennpj'] + + version('5.1.1', sha256='39e2a63840054361b728878a35b21bbe38374682ffb4b5c4f8f8f7514dedb58e') + + variant('review', default=False, description='enable modules under review') + variant('rtk', default=False, + description='build the RTK (Reconstruction Toolkit module') + + # TODO: This will not work if the resource is pulled from a spack mirror. + # The build process will checkout the appropriate commit but it needs to be + # a git repository. The copy pulled from the mirror is not a git + # repository. + # NOTE: This problem is reflected in issues #8746 and #14344 and PR #9436. + # resource( + # name='RTK', + # git='https://github.com/SimonRit/RTK.git', + # get_full_repo=True, + # destination='Modules/Remote', + # when='+rtk', + # ) + + depends_on('git', type='build') + depends_on('perl', type='build') + + depends_on('eigen') + depends_on('expat') + depends_on('fftw-api') + depends_on('googletest') + depends_on('hdf5+cxx') + depends_on('jpeg') + depends_on('libpng') + depends_on('libtiff') + depends_on('zlib') + + def cmake_args(self): + args = [ + '-DBUILD_SHARED_LIBS=ON', + '-DITK_USE_SYSTEM_LIBRARIES=ON', + ] + + if '+review' in self.spec: + args.append('-DModule_ITKReview=ON') + else: + args.append('-DModule_ITKReview=OFF') + if '+rtk' in self.spec: + args.append('-DModule_RTK=ON') + else: + args.append('-DModule_RTK=OFF') + + if '^mkl' in self.spec: + args.append('-DITK_USE_MKL=ON') + else: + args.extend([ + '-DITK_USE_MKL=OFF', + '-DUSE_FFTWD=ON', + '-DUSE_FFTWF=ON', + '-DUSE_SYSTEM_FFTW=ON', + ]) + + return args |