Skip to content

Commit

Permalink
merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
zeniheisser committed Nov 4, 2024
2 parents deb07ae + 32a3c69 commit 910bfce
Show file tree
Hide file tree
Showing 732 changed files with 10,812 additions and 15,672 deletions.
6 changes: 4 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# github linguist by default assumes documention in an "examples" directory
# SR (Aug 2020): github linguist by default assumes documention in an "examples" directory
examples/** -linguist-documentation


# AV (Sep 2024): exclude all files from "Source code" release archives produced with git-archive
* export-ignore
44 changes: 44 additions & 0 deletions .github/workflows/archiver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (C) 2020-2024 CERN and UCLouvain.
# Licensed under the GNU Lesser General Public License (version 3 or later).
# Created by: O. Mattelaer (Sep 2024) for the MG5aMC CUDACPP plugin.
# Further modified by: A. Valassi (2024) for the MG5aMC CUDACPP plugin.

import subprocess
import sys

def get_all_tags():
out = subprocess.check_output(['git', 'tag']).decode()
return out.split('\n')

def get_supported_versions(tags):
versions = [ t[len(PREFIX):-len(SUFFIX)] for t in tags if t.startswith(PREFIX) and t.endswith(SUFFIX)]
versions = set(versions)
return versions

def create_infodat_file(path, versions):
line = "%(version)s https://github.com/%(repo)s/releases/download/%(prefix)s%(version)s%(suffix)s/cudacpp.tar.gz\n"
with open(path, 'w') as fsock:
for v in versions:
fsock.write(line%{'repo':GITHUB_REPO, 'prefix':PREFIX, 'version':v, 'suffix':SUFFIX})

if "__main__" == __name__:
if len(sys.argv) != 3:
print('Usage: python3 %s <repoowner/reponame> <infodat>'%sys.argv[0])
sys.exit(1)
print('Executing: python3 %s "%s" "%s"'%( sys.argv[0],sys.argv[1],sys.argv[2]))
repo = sys.argv[1]
infodat = sys.argv[2]
repo_owner, repo_name = repo.split('/')
###print('Repo owner:', repo_owner)
###print('Repo name:', repo_name)
GITHUB_REPO = '%s/%s/'%(repo_owner, repo_name)
PREFIX = 'cudacpp_for'
if repo_owner != 'madgraph5' : PREFIX = repo_owner + "_" + PREFIX # TEMPORARY! this will change eventually...
if repo_name != 'madgraph4gpu' : raise Exception('Invalid repo_name "%s" (expect "madgraph4gpu")'%repo_name) # TEMPORARY! this will change eventually...
SUFFIX = '_latest'
tags = get_all_tags()
###print('Tags:', tags)
versions = get_supported_versions(tags)
###print('Supported versions:', versions)
create_infodat_file(infodat, versions)
67 changes: 67 additions & 0 deletions .github/workflows/archiver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
# Copyright (C) 2020-2024 CERN and UCLouvain.
# Licensed under the GNU Lesser General Public License (version 3 or later).
# Created by: A. Valassi (Sep 2024) for the MG5aMC CUDACPP plugin.
# Further modified by: A. Valassi (2024) for the MG5aMC CUDACPP plugin.

# Path to the top directory of madgraphgpu
# In the CI this would be simply $(pwd), but allow the script to be run also outside the CI
echo "Executing $0 $*"
topdir=$(cd $(dirname $0)/../..; pwd)

# Check that all git submodules have been updated
cd ${topdir}
if ! git submodule status | grep '^ ' > /dev/null; then
echo "ERROR! There are git submodules that need to be updated"
git submodule status
exit 1
fi
mg5_commit_current=$(git submodule status | awk '/ MG5aMC\/mg5amcnlo /{print substr($1,0,7)}')

# Create a temporary directory and a VERSION.txt file
cd ${topdir}/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT
tmpdir=$(mktemp -d)
outdir=${tmpdir}/CUDACPP_OUTPUT
mkdir ${outdir}
outfile=${outdir}/VERSION.txt
touch ${outfile}
dateformat='%Y-%m-%d_%H:%M:%S UTC'
cudacpp_major=$(cat __init__.py | grep __version__ | sed -r 's/(.*=|\(|\)|,)/ /g' | awk '{print $1}')
cudacpp_minor=$(cat __init__.py | grep __version__ | sed -r 's/(.*=|\(|\)|,)/ /g' | awk '{print $2}')
cudacpp_patch=$(cat __init__.py | grep __version__ | sed -r 's/(.*=|\(|\)|,)/ /g' | awk '{print $3}')
###echo "(From CUDACPP_OUTPUT/__init__.py)"
###echo "cudacpp (major, minor, patch) = ( ${cudacpp_major}, ${cudacpp_minor}, ${cudacpp_patch} )"
if [ ${cudacpp_major} -lt 0 ] || [ ${cudacpp_major} -gt 99 ]; then echo "ERROR! cudacpp_major is not in the [0,99] range"; exit 1; fi
if [ ${cudacpp_minor} -lt 0 ] || [ ${cudacpp_minor} -gt 99 ]; then echo "ERROR! cudacpp_minor is not in the [0,99] range"; exit 1; fi
if [ ${cudacpp_patch} -lt 0 ] || [ ${cudacpp_patch} -gt 99 ]; then echo "ERROR! cudacpp_patch is not in the [0,99] range"; exit 1; fi
cudacpp_version=$(printf "%1d.%02d.%02d" ${cudacpp_major} ${cudacpp_minor} ${cudacpp_patch})
echo "(From CUDACPP_OUTPUT/__init__.py)" >> ${outfile}
echo "cudacpp_version = ${cudacpp_version}" >> ${outfile}
echo "mg5_version_minimal = $(cat __init__.py | awk '/minimal_mg5amcnlo_version/{print $3}' | sed 's/(//' | sed 's/)//' | sed 's/,/./g')" >> ${outfile}
echo "mg5_version_latest_validated = $(cat __init__.py | awk '/latest_validated_version/{print $3}' | sed 's/(//' | sed 's/)//' | sed 's/,/./g')" >> ${outfile}
echo "" >> ${outfile}
echo "(From MG5AMC/mg5amcnlo)" >> ${outfile}
echo "mg5_version_current = $(cat ../../../../../MG5aMC/mg5amcnlo/VERSION | awk '/version =/{print $3}' | sed -r 's/[^0-9.]//g')" >> ${outfile}
echo "mg5_commit_current = ${mg5_commit_current}" >> ${outfile}
echo "" >> ${outfile}
echo "TARBALL DATE: $(date -u +"${dateformat}")" >> ${outfile}
echo "" >> ${outfile}
TZ=UTC git --no-pager log -n1 --date=format-local:"${dateformat}" --pretty=format:'commit %h%nAuthor: %an%nAuthorDate: %ad%nCommitter: %cn%nCommitterDate: %cd%nMessage: "%s"%n' >> ${outfile}
python3 -c 'print("="*132)'; cat ${outfile}; python3 -c 'print("="*132)'
cp ${outfile} ${topdir}
echo "VERSION.txt file available on ${topdir}/$(basename ${outfile})"

# Copy all relevant plugin files to the temporary directory
cd ${topdir}/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT
for file in $(git ls-tree --name-only HEAD -r); do
if [ "${file/acceptance_tests}" != "${file}" ]; then continue; fi # acceptance_tests are not needed for code generation
mkdir -p ${outdir}/$(dirname ${file})
cp -dp ${file} ${outdir}/${file} # preserve symlinks for AUTHORS, COPYING, COPYING.LESSER and COPYRIGHT
done

# Create the tgz archive
outtgz=cudacpp.tar.gz
cd ${tmpdir}
tar -czf ${outtgz} CUDACPP_OUTPUT
mv ${outtgz} ${topdir}
echo "Archive available on ${topdir}/${outtgz}"
Loading

0 comments on commit 910bfce

Please sign in to comment.