Skip to content

Commit

Permalink
0.2 rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
gramian committed Jul 7, 2022
1 parent bb9e055 commit fd75930
Show file tree
Hide file tree
Showing 24 changed files with 582 additions and 651 deletions.
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ authors:
title: matrico
type: software
abstract: "A flonum matrix module for CHICKEN Scheme."
version: 0.1
date-released: 2022-05-01
version: 0.2
date-released: 2022-07-07
commit:
license: zlib-Acknowledgement
repository: https://github.com/gramian/matrico
Expand Down
92 changes: 52 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,71 @@

CSC = csc
CSI = csi
CHICKEN_INSTALL = chicken-install
CHICKEN_PROFILE = chicken-profile
TEST_NEW_EGG = test-new-egg

CLARG =
LEVEL = -O4
FLAGS = -d0 -C -O2 -C -pipe
DEBUG = -d0
override FLAGS += -C -O2 -C -pipe

VERSION = $(shell csi -b version.scm -p "(matrico-version)")

DIM = 1000

.PHONY: benchmark, linpack
.PHONY: linpack, matmul

default:
$(CSC) -shared -emit-import-library matrico $(LEVEL) $(FLAGS) matrico.scm
$(CSC) -shared -emit-import-library matrico $(LEVEL) $(DEBUG) $(FLAGS) matrico.scm

test:
$(CSI) tests/run.scm

test_egg_local:
tar cvzf matrico-$(VERSION).tar.gz \
../matrico/AUTHORS ../matrico/CITATION.cff ../matrico/LICENSE ../matrico/README.md \
../matrico/matrico.egg ../matrico/matrico.release-info ../matrico/matrico-logo.svg \
../matrico/matrico.scm ../matrico/RUNME.scm ../matrico/version.scm \
../matrico/src/dense.scm ../matrico/src/f64vector.scm ../matrico/src/fpmath.scm ../matrico/src/matrix.scm ../matrico/src/mx.scm ../matrico/src/utils.scm \
../matrico/tests/check.scm ../matrico/tests/run.scm ../matrico/tests/test-f64vector.scm ../matrico/tests/test-fpmath.scm ../matrico/tests/test-matrico.scm ../matrico/tests/test-utils.scm
python3 -m http.server &
test-new-egg matrico http://0.0.0.0:8000/matrico.release-info
tar cvzf matrico-$(VERSION).tar.gz --transform 's,^,matrico/,' \
AUTHORS CITATION.cff LICENSE README.md \
matrico.egg matrico.release-info matrico-logo.svg \
matrico.scm RUNME.scm version.scm \
src/dense.scm src/f64vector.scm src/fpmath.scm src/matrix.scm src/mx.scm src/utils.scm \
tests/check.scm tests/run.scm tests/test-f64vector.scm tests/test-fpmath.scm tests/test-matrico.scm tests/test-utils.scm
python3 -m http.server --bind 127.0.0.1 &
sleep 1
$(TEST_NEW_EGG) matrico http://0.0.0.0:8000/matrico.release-info
pkill -9 -f 'python3 -m http.server'

test_egg_remote:
test-new-egg matrico https://raw.githubusercontent.com/gramian/matrico/main/matrico.release-info
$(TEST_NEW_EGG) matrico https://raw.githubusercontent.com/gramian/matrico/main/matrico.release-info

test_install:
CHICKEN_INSTALL_REPOSITORY="/tmp/matrico" chicken-install -test
CHICKEN_REPOSITORY_PATH="`chicken-install -repository`:/tmp/matrico" $(CSI) -e "(import matrico) (matrico-help)"

benchmark:
@rm -f benchmark.txt
make benchset DIM=125
make benchset DIM=250
make benchset DIM=500
make benchset DIM=1000
@cat benchmark.txt

benchset:
@echo "## $(DIM):" >> benchmark.txt
make benchrun LEVEL='-O0'
make benchrun LEVEL='-O1'
make benchrun LEVEL='-O2'
make benchrun LEVEL='-O3'
make benchrun LEVEL='-O4'
make benchrun LEVEL='-O5'

benchrun:
CHICKEN_INSTALL_REPOSITORY="/tmp/matrico" $(CHICKEN_INSTALL) -test
CHICKEN_REPOSITORY_PATH="`$(CHICKEN_INSTALL) -repository`:/tmp/matrico" $(CSI) -e "(import matrico) (matrico-cite)"

iprofile:
make matmul LEVEL='-O4' FLAGS='-profile' DIM=1000
ls -1 PROFILE.* | sort -n | head -n1 | $(CHICKEN_PROFILE)

sprofile:
make matmul LEVEL='-O4' DEBUG='-d3' DIM=1000 CLARG='-:P1000'
ls -1 PROFILE.* | sort -n | head -n1 | $(CHICKEN_PROFILE)

matmul:LEVEL=-O5
matmul:
@echo "(include \"matrico.scm\") \
(import matrico) \
(time (mx-gram (mx-random $(DIM) $(DIM) -1.0 1.0))) \
(exit)" | $(CSC) $(LEVEL) $(FLAGS) - -o /tmp/benchmark
@/tmp/benchmark 2>> benchmark.txt
(import (chicken time)) \
(define A (mx-random $(DIM) $(DIM) -1.0 1.0)) \
(define B (mx-random $(DIM) $(DIM) -1.0 1.0)) \
(define t0 (current-seconds)) \
(define C (time (mx-dot* A B))) \
(define t1 (current-seconds)) \
(print "Megaflops:" #\space (/ (* $(DIM) $(DIM) $(DIM)) (* (- t1 t0) 1000.0 1000.0))) \
(newline) \
(exit)" | $(CSC) $(LEVEL) $(FLAGS) - -o /tmp/matmul
@/tmp/matmul $(CLARG) 2> matmul.txt
@cat matmul.txt

linpack:LEVEL=-O5
linpack:
@echo "(include \"matrico.scm\") \
(import matrico) \
Expand All @@ -68,12 +76,16 @@ linpack:
(define t0 (current-seconds)) \
(define solver (time (mx-solver A))) \
(define t1 (current-seconds)) \
(print "Megaflops/s:" #\space (/ (* $(DIM) $(DIM) $(DIM)) (* (- t1 t0) 1000.0 1000.0))) \
(print "Megaflops:" #\space (/ (* $(DIM) $(DIM) $(DIM)) (* (- t1 t0) 1000.0 1000.0))) \
(print "Residual:" #\space (mx-norm (mx- (solver b) 1.0) 2)) \
(exit)" | $(CSC) -O5 $(FLAGS) - -o /tmp/linpack
@/tmp/linpack 2> linpack.txt
(newline) \
(exit)" | $(CSC) $(LEVEL) $(FLAGS) - -o /tmp/linpack
@/tmp/linpack $(CLARG) 2> linpack.txt
@cat linpack.txt

clean:
rm -f benchmark.txt linpack.txt matrico.so matrico.import.scm matrico-$(VERSION).tar.gz
rm -f test.csv test.mx linpack.txt matmul.txt \
matrico.so matrico.import.scm matrico.import.so matrico.static.o \
matrico.build.sh matrico.install.sh matrico.link matrico.static.so \
matrico-$(VERSION).tar.gz

Loading

0 comments on commit fd75930

Please sign in to comment.