generated from seqan/app-template
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
115 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
|
||
reset_scripts() { | ||
sed -i "s/DO_TIME=1/DO_TIME=0/" $SCRIPT_DIR/gcc.sh | ||
sed -i "s/DO_TIME=1/DO_TIME=0/" $SCRIPT_DIR/g++.sh | ||
} | ||
trap reset_scripts EXIT | ||
|
||
set -ex | ||
|
||
cmake $SCRIPT_DIR/../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=$SCRIPT_DIR/g++.sh -DCMAKE_C_COMPILER=$SCRIPT_DIR/gcc.sh -DUSE_CCACHE=OFF | ||
|
||
sed -i "s/DO_TIME=0/DO_TIME=1/" $SCRIPT_DIR/gcc.sh | ||
sed -i "s/DO_TIME=0/DO_TIME=1/" $SCRIPT_DIR/g++.sh | ||
|
||
make -k -j4 cli_test api_test | ||
|
||
find . -name "ram_usage.*" -exec cat {} + > complete.txt | ||
$SCRIPT_DIR/parse.py complete.txt stats.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
GCC="/usr/bin/g++-11" | ||
DO_TIME=0 | ||
|
||
if [[ DO_TIME -eq 0 ]]; then | ||
exec "$GCC" "$@" | ||
else | ||
FILE=$(mktemp ram_usage.XXXXXXXX) | ||
exec /usr/bin/time -v "$GCC" "$@" 2> $FILE | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
GCC="/usr/bin/gcc-11" | ||
DO_TIME=0 | ||
|
||
if [[ DO_TIME -eq 0 ]]; then | ||
exec "$GCC" "$@" | ||
else | ||
FILE=$(mktemp ram_usage.XXXXXXXX) | ||
exec /usr/bin/time -v "$GCC" "$@" 2> $FILE | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python3 | ||
# ----------------------------------------------------------------------------------------------------- | ||
# Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin | ||
# Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik | ||
# This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License | ||
# shipped with this file and also available at: https://github.com/seqan/raptor/blob/master/LICENSE.md | ||
# ----------------------------------------------------------------------------------------------------- | ||
# | ||
# Usage ram_usage.py <input_file> <output_file> | ||
# | ||
# Computes a table with RAM-Usage from a file containing output of `time -v`. | ||
import argparse | ||
import os | ||
import pandas | ||
|
||
parser = argparse.ArgumentParser(description='Parse time and memory consumption of compiling.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
parser.add_argument('input', type=str, help='File containing all outputs of `time -v`.') | ||
parser.add_argument('output', type=str, help='File to write output to. (CSV)') | ||
arguments = parser.parse_args() | ||
|
||
file_names = [] | ||
ram_usages = [] | ||
run_times = [] | ||
|
||
with open(arguments.input, 'r') as input_file: | ||
parsing_ram_usage = False | ||
for line_number, line in enumerate(input_file): | ||
if line_number % 23 == 0: | ||
index_of_unit = line.rfind('-c') | ||
if index_of_unit != - 1: | ||
parsing_ram_usage = True | ||
file_names.append(line[index_of_unit:][:-2].split('/')[-1]) | ||
else: | ||
parsing_ram_usage = False | ||
if parsing_ram_usage and ((line_number - 9) % 23) == 0: | ||
ram_usages.append(int(line.split(' ')[-1]) // 1024) | ||
if parsing_ram_usage and ((line_number - 4) % 23) == 0: | ||
run_times.append(line.strip().split(' ')[-1].lstrip('0:')) | ||
|
||
with open(arguments.output, 'w') as output_file: | ||
df = pandas.DataFrame({'File' : file_names, 'RAM in MiB' : ram_usages, 'Time in s' : run_times}) | ||
df = df.sort_values(by=['File'], ascending=True) | ||
df.to_csv(output_file, index=False) |