Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 0c99b1003662bd784e6c4d9d5053874918cc5ade authored by EPiQC on 08 July 2019, 21:28:06 UTC, committed by GitHub on 08 July 2019, 21:28:06 UTC
Merge pull request #38 from AndrewLitteken/master
Segmentation Faults and Fixes to Run main branch on macOS
2 parent s 98275a9 + 5ea8679
  • Files
  • Changes
  • 5e79c08
  • /
  • scripts
  • /
  • gen-cp.sh
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:0c99b1003662bd784e6c4d9d5053874918cc5ade
directory badge
swh:1:dir:50473866082fc18b42173bdb06907d59a8383528
content badge
swh:1:cnt:3d4d0d6cfe3f163bdc2b3231f29d6a9a02fd791a

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
gen-cp.sh
#!/bin/bash

DIR=$(dirname $0)
ROOT=$DIR/..
OPT=$ROOT/build/Release+Asserts/bin/opt
SCAF=$ROOT/build/Release+Asserts/lib/Scaffold.so

# Module flattening threshold
# note: thresholds must be picked from the set in scripts/flattening_thresh.py
THRESHOLDS=(010k 100k 2M 25M)

# Create directory to put all byproduct and output files in
for f in $*; do
  b=$(basename $f .scaffold)  
  echo "[gen-cp.sh] $b: Creating output directory ..."
  mkdir -p "$b"
  #mv ./*${b}* ${b} 2>/dev/null
done

# Generate .ll file if not done already
for f in $*; do
  b=$(basename $f .scaffold)
  echo "[gen-cp.sh] $b: Compiling ..."
  if [ ! -e ${b}/${b}.ll ]; then
    # Generate compiled files
    $ROOT/scaffold.sh -rk $f
    mv ${b}11.ll ${b}11.ll.keep_me
    # clean intermediary compilation files (comment out for speed)
    $ROOT/scaffold.sh -c $f
    # Keep the final output for the compilation
    mv ${b}11.ll.keep_me ${b}/${b}.ll
  fi
done

# Module flattening pass with different thresholds, then critical path calculation.
for f in $*; do
  b=$(basename $f .scaffold)  
  echo "[gen-cp.sh] $b: Flattening"
  echo "[gen-cp.sh] Computing module gate counts ..."
  $OPT -S -load $SCAF -ResourceCount2 ${b}/${b}.ll > /dev/null 2> ${b}.out
  python $DIR/flattening_thresh.py ${b}
  for th in ${THRESHOLDS[@]}; do    
    if [ ! -e ${b}/${b}.flat${th}.ll ]; then      
      echo "[gen-cp.sh] Flattening modules smaller than Threshold = $th ..."
      mv ${b}.flat${th}.txt flat_info.txt
      $OPT -S -load $SCAF -FlattenModule -dce -internalize -globaldce ${b}/${b}.ll -o ${b}/${b}.flat${th}.ll
    fi
    if [ ! -e ${b}/${b}.flat${th}.cp ]; then
      echo "[gen-cp.sh] Critical path calculation ..."        
      /usr/bin/time -v $OPT -load $SCAF -GetCriticalPath ${b}/${b}.flat${th}.ll >/dev/null 2> ${b}/${b}.flat${th}.cp
    fi
  done
  rm -f *flat*txt ${b}.out
  echo "[gen-cp.sh] Critical path lengths written to ${b}*.cp"
done
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API