fibonacci test update

main
phani 5 years ago
parent affe5fbc35
commit 3fab99424a

@ -44,7 +44,7 @@ else ifeq ($(USE_MEM),USE_MEM_VM)
CFILES += ${RTDIR}/memory/64bit_nix.c CFILES += ${RTDIR}/memory/64bit_nix.c
endif endif
all: clean runtime tools all: clean runtime #tools
runtime: runtime:
@echo "Compiling runtime" @echo "Compiling runtime"
@ -57,7 +57,7 @@ tools:
clean: clean:
@rm -f core @rm -f core
# @echo "Cleaning up runtime" @echo "Cleaning up runtime"
@rm -f ${RUNTIME} @rm -f ${RUNTIME}
# @echo "Cleaning up tools" # @echo "Cleaning up tools"
@${MAKE} -C tools clean @${MAKE} -C tools clean

@ -2,7 +2,7 @@ include Makefile.inc
BENCH_DIR=../../silverfish/code_benches/ BENCH_DIR=../../silverfish/code_benches/
TESTS=empty work TESTS=fibonacci #empty work
#TESTS=forever filesys sockserver sockclient empty #TESTS=forever filesys sockserver sockclient empty
TESTSRT=$(TESTS:%=%_rt) TESTSRT=$(TESTS:%=%_rt)
BENCHES=adpcm basic_math binarytrees bitcount blowfish crc dijkstra fft function_pointers \ BENCHES=adpcm basic_math binarytrees bitcount blowfish crc dijkstra fft function_pointers \
@ -30,23 +30,25 @@ rttests: $(TESTSRT)
clean: clean:
@rm -rf ${TMP_DIR} @rm -rf ${TMP_DIR}
@rm -f ${BIN_DIR}/*_wasm.so #@rm -f ${BIN_DIR}/*_wasm.so
%_sf: %_sf:
@mkdir -p ${TMP_DIR} @mkdir -p ${TMP_DIR}
@echo "Compiling $(@:%_sf=%)" @echo "Compiling $(@:%_sf=%)"
${WASMCC} ${$(@:%_sf=%)_CFLAGS} ${WASMCFLAGS} ${OPTFLAGS} ${BENCH_DIR}/$(@:%_sf=%)/*.c -o ${TMP_DIR}/$(@:%_sf=%).wasm ${WASMCC} ${$(@:%_sf=%)_CFLAGS} ${WASMCFLAGS} ${OPTFLAGS} ${BENCH_DIR}/$(@:%_sf=%)/*.c $(DUMMY) -o ${TMP_DIR}/$(@:%_sf=%).wasm
${SFCC} ${TMP_DIR}/$(@:%_sf=%).wasm -o ${TMP_DIR}/$(@:%_sf=%).bc ${SFCC} ${TMP_DIR}/$(@:%_sf=%).wasm -o ${TMP_DIR}/$(@:%_sf=%).bc
${CC} --shared -fPIC ${OPTFLAGS} -I${RT_INC} -D${USE_MEM} ${TMP_DIR}/$(@:%_sf=%).bc ${MEMC} ${WASMISA} -o ${TMP_DIR}/$(@:%_sf=%)_wasm.so ${CC} ${CFLAGS} ${OPTFLAGS} -D${USE_MEM} ${TMP_DIR}/$(@:%_sf=%).bc ${MEMC} ${RT_LIBC} ${RT_RT} -o ${TMP_DIR}/$(@:%_sf=%)_wasm.out
@cp ${TMP_DIR}/$(@:%_sf=%)_wasm.so ${BIN_DIR} ${CC} --shared -fPIC ${OPTFLAGS} -I${ART_INC} -D${USE_MEM} ${TMP_DIR}/$(@:%_sf=%).bc ${AMEMC} ${WASMISA} -o ${TMP_DIR}/$(@:%_sf=%)_wasm.so
@rm -rf ${TMP_DIR} @cp ${TMP_DIR}/$(@:%_sf=%)_wasm.so ${ABIN_DIR}
# @rm -rf ${TMP_DIR}
%_rt: %_rt:
@mkdir -p ${TMP_DIR} @mkdir -p ${TMP_DIR}
@echo "Compiling $(@:%_rt=%)" @echo "Compiling $(@:%_rt=%)"
${WASMCC} ${$(@:%_rt=%)_CFLAGS} ${WASMCFLAGS} ${OPTFLAGS} $(@:%_rt=%)/*.c -o ${TMP_DIR}/$(@:%_rt=%).wasm ${WASMCC} ${$(@:%_rt=%)_CFLAGS} ${WASMCFLAGS} ${OPTFLAGS} $(@:%_rt=%)/*.c $(DUMMY) -o ${TMP_DIR}/$(@:%_rt=%).wasm
${SFCC} ${TMP_DIR}/$(@:%_rt=%).wasm -o ${TMP_DIR}/$(@:%_rt=%).bc ${SFCC} ${TMP_DIR}/$(@:%_rt=%).wasm -o ${TMP_DIR}/$(@:%_rt=%).bc
${CC} --shared -fPIC ${OPTFLAGS} -I${RT_INC} -D${USE_MEM} ${TMP_DIR}/$(@:%_rt=%).bc ${MEMC} ${WASMISA} -o ${TMP_DIR}/$(@:%_rt=%)_wasm.so ${CC} ${CFLAGS} ${OPTFLAGS} -D${USE_MEM} ${TMP_DIR}/$(@:%_rt=%).bc ${MEMC} ${RT_LIBC} ${RT_RT} -o ${TMP_DIR}/$(@:%_rt=%)_wasm.out
@cp ${TMP_DIR}/$(@:%_rt=%)_wasm.so ${BIN_DIR} ${CC} --shared -fPIC ${OPTFLAGS} -I${ART_INC} -D${USE_MEM} ${TMP_DIR}/$(@:%_rt=%).bc ${AMEMC} ${WASMISA} -o ${TMP_DIR}/$(@:%_rt=%)_wasm.so
@rm -rf ${TMP_DIR} @cp ${TMP_DIR}/$(@:%_rt=%)_wasm.so ${ABIN_DIR}
# @rm -rf ${TMP_DIR}

@ -8,17 +8,32 @@ OPTFLAGS=-O3 -flto
WASMLINKFLAGS=-Wl,-z,stack-size=524288,--allow-undefined,--no-threads,--stack-first,--no-entry,--export-all,--export=main,--export=dummy WASMLINKFLAGS=-Wl,-z,stack-size=524288,--allow-undefined,--no-threads,--stack-first,--no-entry,--export-all,--export=main,--export=dummy
WASMCFLAGS=${WASMLINKFLAGS} -nostartfiles WASMCFLAGS=${WASMLINKFLAGS} -nostartfiles
BASE_DIR=../../ MEMC_64=64bit_nix.c
MEMC_NO=no_protection.c
MEMC_GEN=generic.c
MEMC_MPX=mpx.c
MEMC_SEG=segmented.c
BASE_DIR=../../silverfish/
RT_DIR=${BASE_DIR}/runtime/ RT_DIR=${BASE_DIR}/runtime/
RT_INC=${RT_DIR}/include/ RT_MEM=${RT_DIR}/memory/
RT_LIBC=${RT_DIR}/libc/libc_backing.c
RT_RT=${RT_DIR}/runtime.c
USE_MEM=USE_MEM_VM MEMC=${RT_MEM}/${MEMC_64}
DUMMY=${BASE_DIR}/code_benches/dummy.c
# for awsm
ABASE_DIR=../../
ART_DIR=${ABASE_DIR}/runtime/
ART_INC=${ART_DIR}/include/
USE_MEM=USE_MEM_VM
ifeq ($(USE_MEM),USE_MEM_VM) ifeq ($(USE_MEM),USE_MEM_VM)
MEMC=${RT_DIR}/compiletime/memory/64bit_nix.c AMEMC=${ART_DIR}/compiletime/memory/${MEMC_64}
endif endif
WASMISA=${ART_DIR}/compiletime/instr.c
WASMISA=${RT_DIR}/compiletime/instr.c ABIN_DIR=${ART_DIR}/bin/
BIN_DIR=${RT_DIR}/bin/
TMP_DIR=tmp/ TMP_DIR=tmp/

@ -37,7 +37,7 @@ print_time(unsigned long long s, unsigned long long e)
#if 0 #if 0
printf("%llu cycs, %llu us\n", e - s, (e - s) / CPU_FREQ); printf("%llu cycs, %llu us\n", e - s, (e - s) / CPU_FREQ);
#else #else
fprintf(stderr, "%llu us\n", e - s); fprintf(stdout, "%llu us\n", e - s);
#endif #endif
} }

@ -16,7 +16,7 @@ main(int argc, char **argv)
unsigned long long st = get_time(), en; unsigned long long st = get_time(), en;
r = fib(n); r = fib(n);
en = get_time(); en = get_time();
printf("%lu\n", r); fprintf(stderr, "%lu\n", r);
print_time(st, en); print_time(st, en);
return 0; return 0;

@ -0,0 +1,33 @@
#!/bin/sh
ITERS=$3
# before running this benchmark,
# copy fibonacci to fibonacci_native.out
testeach()
{
tmp_cnt=${ITERS}
exe_relpath=$1
echo "${exe_relpath} ($2) for ${tmp_cnt}"
while [ ${tmp_cnt} -gt 0 ]; do
bench=$(echo $2 | $exe_relpath 2>/dev/null)
tmp_cnt=$((tmp_cnt - 1))
echo "$bench"
done
echo "Done!"
}
MAXNUM=$2
tmp1_cnt=${MAXNUM}
while [ ${tmp1_cnt} -gt 0 ]; do
testeach ./fibonacci_$1.out ${tmp1_cnt}
tmp1_cnt=$((tmp1_cnt - 1))
done
echo "All done!"
Loading…
Cancel
Save