forked from bytecodealliance/sightglass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable native benchmarking in new
shootout
directory
This change refactors how the shootout native benchmarks are built. The `Dockerfile.native` file is retained and is expected to be _the_ way to build the native shared libraries for this kind of benchmarking. A `build-native.sh` script is included in the directory to (a) be used by `Dockerfile.native` and (b) for building the native benchmarks in environments where running Docker may not be possible. Now that all of the benchmarks are built in one directory, the native libraries cannot all be named `benchmark.so`. Because of this and the hard-coded path expected by the native engine (see bytecodealliance#259), this change also modifies the associated `*-native.sh` scripts to set up a temporary directory that looks like the `benchmark.so` environment that was there previously. This additional logic could be removed once bytecodealliance#259 is fixed.
- Loading branch information
Showing
6 changed files
with
82 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
*/benchmark.so | ||
*/*.so | ||
*/target |
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
FROM ubuntu:20.04 | ||
ENV DEBIAN_FRONTEND="noninteractive" TZ="America" | ||
RUN apt update && apt-get install -y --no-install-recommends wget build-essential | ||
|
||
# Copy in the `src` directory. | ||
ENV SRC=/usr/src/shootout | ||
WORKDIR $SRC | ||
COPY src . | ||
COPY build-native.sh . | ||
COPY libengine.so /usr/lib | ||
|
||
# Compile each of the benchmarks into the `/benchmark` directory. | ||
WORKDIR /benchmark | ||
RUN SRC_DIR=$SRC ENGINE_DIR=/usr/lib $SRC/build-native.sh | ||
# We output the shared libraries to the `/benchmark` directory, where the client | ||
# expects it. |
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Build all of the shootout benchmarks as native shared libraries (Linux-only). | ||
# | ||
# Usage: ./build-native.sh | ||
|
||
ENGINE_DIR=${ENGINE_LIBRARY_DIR:-"../../engines/native"} | ||
SRC_DIR=${SRC_DIR:-"src"} | ||
BENCHMARKS=${BENCHMARKS:-$(find $SRC_DIR -name '*.c')} | ||
CFLAGS=${CFLAGS:-"-O3 -fPIC -I$SRC_DIR -Wno-attributes"} | ||
LDFLAGS=${LDFLAGS:-"-shared -L$ENGINE_DIR -lengine"} | ||
|
||
for BENCHMARK in $BENCHMARKS; do | ||
NAME=$(basename $BENCHMARK .c); | ||
cc -Dmain=native_entry $CFLAGS $LDFLAGS $BENCHMARK -o shootout-$NAME.so | ||
done |