alpgen: new package (#26713)

Co-authored-by: Bernhard Kaindl <43588962+bernhardkaindl@users.noreply.github.com>
This commit is contained in:
iarspider 2021-10-14 16:58:09 +02:00 committed by GitHub
parent 49354140be
commit 160371f879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 6922 additions and 0 deletions

View File

@ -0,0 +1,69 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
#----------------------------------------------------------------------------
project(alpgen Fortran)
#----------------------------------------------------------------------------
#---Compilation and Link options----------------------------------------------
if(CMAKE_SYSTEM_NAME MATCHES Darwin)
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup")
endif()
set(CMAKE_Fortran_FLAGS_DEBUG "-fPIC -g -fno-automatic -std=legacy")
set(CMAKE_Fortran_FLAGS_MINSIZEREL "-fPIC -Os -DNDEBUG -fno-automatic -std=legacy")
set(CMAKE_Fortran_FLAGS_RELEASE "-fPIC -O2 -DNDEBUG -fno-automatic -std=legacy")
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-fPIC -O2 -g -fno-automatic -std=legacy")
#---Select sources for the various libraries---------------------------------
file(GLOB alpgen_sources ${PROJECT_SOURCE_DIR}/alplib/Acp.f
${PROJECT_SOURCE_DIR}/alplib/Acp.f ${PROJECT_SOURCE_DIR}/alplib/Aint.f ${PROJECT_SOURCE_DIR}/alplib/alpgen.f ${PROJECT_SOURCE_DIR}/alplib/alppdf.f
${PROJECT_SOURCE_DIR}/alplib/alputi.f ${PROJECT_SOURCE_DIR}/alplib/Asu3.f)
file(GLOB alpgen_alpsho_sources ${PROJECT_SOURCE_DIR}/alplib/alpsho.f)
file(GLOB sources_libs RECURSIVE ${PROJECT_SOURCE_DIR}/*lib)
file(GLOB sources_work RECURSIVE ${PROJECT_SOURCE_DIR}/*work)
file(GLOB sources_rest RECURSIVE ${PROJECT_SOURCE_DIR}/DOCS ${PROJECT_SOURCE_DIR}/validation ${PROJECT_SOURCE_DIR}/examples )
file(GLOB source_readme compare prc.list README)
#---Add libraries------------------------------------------------------------
add_library(alpgen SHARED ${alpgen_sources})
add_library(alpgen_static STATIC ${alpgen_sources})
set_target_properties(alpgen PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/alplib)
set_target_properties(alpgen_static PROPERTIES OUTPUT_NAME alpgen ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/alplib)
add_library(alpsho SHARED ${alpgen_alpsho_sources})
add_library(alpsho_static STATIC ${alpgen_alpsho_sources})
set_target_properties(alpsho PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/alplib)
set_target_properties(alpsho_static PROPERTIES OUTPUT_NAME alpsho ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/alplib)
file(GLOB alpgen_herlib_sources ${PROJECT_SOURCE_DIR}/herlib/atoher.f)
file(GLOB alpgen_pylib_sources ${PROJECT_SOURCE_DIR}/pylib/atopyt.f)
add_library(atoher SHARED ${alpgen_herlib_sources})
add_library(atoher_static STATIC ${alpgen_herlib_sources})
set_target_properties(atoher PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/herlib)
set_target_properties(atoher_static PROPERTIES OUTPUT_NAME atoher ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/herlib)
add_library(atopyt SHARED ${alpgen_pylib_sources})
add_library(atopyt_static STATIC ${alpgen_pylib_sources})
set_target_properties(atopyt PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/pylib)
set_target_properties(atopyt_static PROPERTIES OUTPUT_NAME atopyt ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/herlib)
#---Install build products---------------------------------------------------
install(TARGETS alpgen alpsho atoher atopyt DESTINATION lib)
install(TARGETS alpgen_static alpsho_static atoher_static atopyt_static DESTINATION lib)
#---create subdirectory archive with symlinks----------------------------------
install(DIRECTORY ${sources_libs} ${sources_work} ${sources_rest} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/sources)
install(CODE "execute_process(COMMAND cmake -E create_symlink sources ${CMAKE_INSTALL_PREFIX}/share/alpgen-author)")
install(CODE "file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/archive)")
install(CODE "execute_process(COMMAND cmake -E create_symlink ../libalpgen.a ${CMAKE_INSTALL_PREFIX}/lib/archive/libalpgen.a)")
install(CODE "execute_process(COMMAND cmake -E create_symlink ../libalpsho.a ${CMAKE_INSTALL_PREFIX}/lib/archive/libalpsho.a)")
install(CODE "execute_process(COMMAND cmake -E create_symlink ../libatoher.a ${CMAKE_INSTALL_PREFIX}/lib/archive/libatoher.a)")
install(CODE "execute_process(COMMAND cmake -E create_symlink ../libatopyt.a ${CMAKE_INSTALL_PREFIX}/lib/archive/libatopyt.a)")

View File

@ -0,0 +1,37 @@
diff -Naur tmp/alplib/alpgen.f tmp1/alplib/alpgen.f
--- alplib/alpgen.f 2011-03-28 08:19:18.000000000 +0200
+++ alplib/alpgen.f 2014-03-31 15:37:15.000000000 +0200
@@ -4647,9 +4647,9 @@
c
IMPLICIT NONE
integer time
- character*24 CTIME,now
-c now='Day Mon XX hh:mm:ss yyyy'
- now=ctime(time())
+ character*25 now
+ now='Day Mon XX hh:mm:ss yyyy'
+c now=ctime(time())
end
diff -Naur tmp/alplib/alputi.f tmp1/alplib/alputi.f
--- alplib/alputi.f 2010-12-14 09:03:41.000000000 +0100
+++ alplib/alputi.f 2014-03-28 16:37:36.000000000 +0100
@@ -785,7 +785,7 @@
&,NBIN(200),IHIS(200,100),IUSCORE(200),IOSCORE(200)
&,IENT(200),HAVG(200),HINT(200),HSIG(200),BOOK(200),TITLE(200)
&,NHIST
- CHARACTER TITLE*25,BOOK*3,NOW*24
+ CHARACTER TITLE*25,BOOK*3,NOW*25
CHARACTER*(*) LTIT,BTIT,SCALE
double precision hist
DATA INI/0/
@@ -841,7 +841,7 @@
&,NBIN(200),IHIS(200,100),IUSCORE(200),IOSCORE(200)
&,IENT(200),HAVG(200),HINT(200),HSIG(200),BOOK(200),TITLE(200)
&,NHIST
- CHARACTER TITLE*25,BOOK*3,SCALE*3,NOW*24
+ CHARACTER TITLE*25,BOOK*3,SCALE*3,NOW*25
CHARACTER*(*) LTIT,BTIT,SCA
double precision hist
CHARACTER*7 PLOT(4)

View File

@ -0,0 +1,15 @@
diff --git a/compile.mk b/compile.mk
index 3d2ce16..7e540ca 100755
--- a/compile.mk
+++ b/compile.mk
@@ -17,6 +17,10 @@ ifeq ($(shell uname),Darwin)
FFF = g77 -O1 -Wall -fno-automatic -Wno-globals -fno-backslash \
-ffast-math
endif
+ ifeq ($(shell uname -m), x86_64)
+ FFF = gfortran -O1 -Wall -fno-automatic -fno-backslash -ffast-math
+ FF90 = gfortran -fno-automatic
+ endif
ifeq ($(shell uname -m),i386)
FFF = ifort -V -noautomatic -warn
FF90 = ifort -V -noautomatic -warn

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,104 @@
#!/bin/bash
cd 2Qphwork; make gen; cd ..
cd 2Qwork; make gen; cd ..
cd 4Qwork; make gen; cd ..
cd hjetwork; make gen; cd ..
cd Njetwork; make gen; cd ..
cd QQhwork; make gen; cd ..
cd topwork; make gen; cd ..
cd vbjetwork; make gen; cd ..
cd wcjetwork; make gen; cd ..
cd wphjetwork; make gen; cd ..
cd wphqqwork; make gen; cd ..
cd wqqwork; make gen; cd ..
cd zqqwork; make gen; cd ..
cd phjetwork; make gen;
export USRF=120_180bin
make gen -f cmsMakefile
export USRF=180_240bin
make gen -f cmsMakefile
export USRF=20_60bin
make gen -f cmsMakefile
export USRF=240_300bin
make gen -f cmsMakefile
export USRF=300_5000bin ##this has changed it was up to 7000
make gen -f cmsMakefile
export USRF=60_120bin
make gen -f cmsMakefile
cd ..
cd wjetwork; make gen;
export USRF=0ptw100
make gen -f cmsMakefile
export USRF=100ptw300
make gen -f cmsMakefile
export USRF=300ptw800
make gen -f cmsMakefile
export USRF=800ptw1600
make gen -f cmsMakefile
export USRF=1600ptw3200 #was not in 213 patch
make gen -f cmsMakefile
export USRF=3200ptw5000 #was not in 213 patch
make gen -f cmsMakefile
export USRF=VBFHiggsTo2Tau #was not in 213 patch
make gen -f cmsMakefile
export USRF=2j_vbf_inv #was not in 213 patch
make gen -f cmsMakefile
export USRF=3j_vbf_inv #was not in 213 patch
make gen -f cmsMakefile
export USRF=1600ptw #was not in 212 patch
make gen -f cmsMakefile
cd ..
cd zjetwork; make gen;
export USRF=0ptz100
make gen -f cmsMakefile
export USRF=100ptz300
make gen -f cmsMakefile
export USRF=300ptz800
make gen -f cmsMakefile
export USRF=800ptz1600
make gen -f cmsMakefile
export USRF=1600ptz3200 #was not in 213 patch
make gen -f cmsMakefile
export USRF=3200ptz5000 #was not in 213 patch
make gen -f cmsMakefile
export USRF=VBFHiggsTo2Tau
make gen -f cmsMakefile
export USRF=2j_vbf_inv #was not in 213 patch
make gen -f cmsMakefile
export USRF=3j_vbf_inv #was not in 213 patch
make gen -f cmsMakefile
export USRF=1600ptz #was not in 212 patch
make gen -f cmsMakefile
cd ..
cd Njetwork; make gen; #whole Njetwork was not in 213 patch
export USRF=100_160
make gen -f cmsMakefile
export USRF=100_180
make gen -f cmsMakefile
export USRF=140_180
make gen -f cmsMakefile
export USRF=140_5600
make gen -f cmsMakefile
export USRF=160_200
make gen -f cmsMakefile
export USRF=180_250
make gen -f cmsMakefile
export USRF=180_5600
make gen -f cmsMakefile
export USRF=200_250
make gen -f cmsMakefile
export USRF=20_100
make gen -f cmsMakefile
export USRF=20_80
make gen -f cmsMakefile
export USRF=250_400
make gen -f cmsMakefile
export USRF=400_5600
make gen -f cmsMakefile
export USRF=80_140
make gen -f cmsMakefile
cd ..

View File

@ -0,0 +1,37 @@
#!/bin/bash
if [ $# -ne 1 ];
then echo "Usage: cms_install.sh <prefix>" && exit 1
fi
i=$1
mkdir -p $i/bin
mkdir -p $i/alplib
cp zjetwork/zjet_*gen $i/bin/
cp wjetwork/wjet_*gen $i/bin/
cp phjetwork/phjet_*gen $i/bin/
cp Njetwork/Njet_*gen $i/bin/
cp 2Qphwork/2Qphgen $i/bin/
cp 2Qwork/2Qgen $i/bin/
cp 4Qwork/4Qgen $i/bin/
cp hjetwork/hjetgen $i/bin/
cp Njetwork/Njetgen $i/bin/
cp phjetwork/phjetgen $i/bin/
cp QQhwork/QQhgen $i/bin/
cp topwork/topgen $i/bin/
cp vbjetwork/vbjetgen $i/bin/
cp wcjetwork/wcjetgen $i/bin/
cp wjetwork/wjetgen $i/bin/
cp wphjetwork/wphjetgen $i/bin/
cp wphqqwork/wphqqgen $i/bin/
cp wqqwork/wqqgen $i/bin/
cp zjetwork/zjetgen $i/bin/
cp zqqwork/zqqgen $i/bin/
cp -R alplib/* $i/alplib/

View File

@ -0,0 +1,138 @@
# Copyright 2013-2021 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)
import os
from spack import *
class Alpgen(MakefilePackage):
"""A collection of codes for the generation of
multi-parton processes in hadronic collisions."""
homepage = "http://mlm.home.cern.ch/mlm/alpgen/"
url = "http://mlm.home.cern.ch/mlm/alpgen/V2.1/v214.tgz"
patch('alpgen-214.patch', when='recipe=cms')
patch('alpgen-214-Darwin-x86_84-gfortran.patch', when='platform=darwin recipe=cms')
patch('alpgen-2.1.4-sft.patch', when='recipe=sft', level=0)
depends_on('cmake', type='build', when='recipe=sft')
variant('recipe', values=('cms', 'sft'), default='sft',
description='Select build recipe: CMS for CMS experiment, ' +
'SFT for ATLAS/LHCb/others.')
version('2.1.4', sha256='2f43f7f526793fe5f81a3a3e1adeffe21b653a7f5851efc599ed69ea13985c5e')
phases = ['cmake', 'build', 'install']
# copied from CMakePackage
@property
def build_dirname(self):
"""Returns the directory name to use when building the package
:return: name of the subdirectory for building the package
"""
return 'spack-build-%s' % self.spec.dag_hash(7)
@property
def build_directory(self):
"""Returns the directory to use when building the package
:return: directory where to build the package
"""
return os.path.join(self.stage.path, self.build_dirname)
@property
def root_cmakelists_dir(self):
"""The relative path to the directory containing CMakeLists.txt
This path is relative to the root of the extracted tarball,
not to the ``build_directory``. Defaults to the current directory.
:return: directory containing CMakeLists.txt
"""
return self.stage.source_path
def cmake_args(self):
"""Produces a list containing all the arguments that must be passed to
cmake, except:
* CMAKE_INSTALL_PREFIX
* CMAKE_BUILD_TYPE
which will be set automatically.
:return: list of arguments for cmake
"""
return []
@property
def std_cmake_args(self):
"""Standard cmake arguments provided as a property for
convenience of package writers
:return: standard cmake arguments
"""
# standard CMake arguments
std_cmake_args = CMakePackage._std_args(self)
std_cmake_args += getattr(self, 'cmake_flag_args', [])
return std_cmake_args
# end
def url_for_version(self, version):
root = self.url.rsplit('/', 2)[0]
return "{0}/V{1}/v{2}.tgz".format(root, version.up_to(2), version.joined)
def patch(self):
if self.spec.satisfies('recipe=sft'):
copy(join_path(os.path.dirname(__file__), 'CMakeLists.txt'),
'CMakeLists.txt')
if self.spec.satisfies('recipe=cms'):
filter_file('-fno-automatic', '-fno-automatic -std=legacy', 'compile.mk')
@when('recipe=cms')
def cmake(self, spec, prefix):
return
@when('recipe=cms')
def build(self, spec, prefix):
bash = which('bash')
bash('./cms_build.sh')
@when('recipe=cms')
def install(self, spec, prefix):
bash = which('bash')
bash('./cms_install.sh', prefix)
for root, dirs, files in os.walk(prefix):
set_install_permissions(root)
for file in files:
set_install_permissions(file)
@when('recipe=sft')
def cmake(self, spec, prefix):
"""Runs ``cmake`` in the build directory"""
options = self.std_cmake_args
options += self.cmake_args()
options.append(os.path.abspath(self.root_cmakelists_dir))
with working_dir(self.build_directory, create=True):
cmake_x = which('cmake')
cmake_x(*options)
@when('recipe=sft')
def build(self, spec, prefix):
"""Make the build targets"""
with working_dir(self.build_directory):
make()
@when('recipe=sft')
def install(self, spec, prefix):
"""Make the install targets"""
with working_dir(self.build_directory):
make('install')