Skip to content

Commit fd75930

Browse files
committed
0.2 rc1
1 parent bb9e055 commit fd75930

24 files changed

+582
-651
lines changed

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ authors:
77
title: matrico
88
type: software
99
abstract: "A flonum matrix module for CHICKEN Scheme."
10-
version: 0.1
11-
date-released: 2022-05-01
10+
version: 0.2
11+
date-released: 2022-07-07
1212
commit:
1313
license: zlib-Acknowledgement
1414
repository: https://github.com/gramian/matrico

Makefile

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,71 @@
22

33
CSC = csc
44
CSI = csi
5+
CHICKEN_INSTALL = chicken-install
6+
CHICKEN_PROFILE = chicken-profile
7+
TEST_NEW_EGG = test-new-egg
58

9+
CLARG =
610
LEVEL = -O4
7-
FLAGS = -d0 -C -O2 -C -pipe
11+
DEBUG = -d0
12+
override FLAGS += -C -O2 -C -pipe
813

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

1116
DIM = 1000
1217

13-
.PHONY: benchmark, linpack
18+
.PHONY: linpack, matmul
1419

1520
default:
16-
$(CSC) -shared -emit-import-library matrico $(LEVEL) $(FLAGS) matrico.scm
21+
$(CSC) -shared -emit-import-library matrico $(LEVEL) $(DEBUG) $(FLAGS) matrico.scm
1722

1823
test:
1924
$(CSI) tests/run.scm
2025

2126
test_egg_local:
22-
tar cvzf matrico-$(VERSION).tar.gz \
23-
../matrico/AUTHORS ../matrico/CITATION.cff ../matrico/LICENSE ../matrico/README.md \
24-
../matrico/matrico.egg ../matrico/matrico.release-info ../matrico/matrico-logo.svg \
25-
../matrico/matrico.scm ../matrico/RUNME.scm ../matrico/version.scm \
26-
../matrico/src/dense.scm ../matrico/src/f64vector.scm ../matrico/src/fpmath.scm ../matrico/src/matrix.scm ../matrico/src/mx.scm ../matrico/src/utils.scm \
27-
../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
28-
python3 -m http.server &
29-
test-new-egg matrico http://0.0.0.0:8000/matrico.release-info
27+
tar cvzf matrico-$(VERSION).tar.gz --transform 's,^,matrico/,' \
28+
AUTHORS CITATION.cff LICENSE README.md \
29+
matrico.egg matrico.release-info matrico-logo.svg \
30+
matrico.scm RUNME.scm version.scm \
31+
src/dense.scm src/f64vector.scm src/fpmath.scm src/matrix.scm src/mx.scm src/utils.scm \
32+
tests/check.scm tests/run.scm tests/test-f64vector.scm tests/test-fpmath.scm tests/test-matrico.scm tests/test-utils.scm
33+
python3 -m http.server --bind 127.0.0.1 &
34+
sleep 1
35+
$(TEST_NEW_EGG) matrico http://0.0.0.0:8000/matrico.release-info
36+
pkill -9 -f 'python3 -m http.server'
3037

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

3441
test_install:
35-
CHICKEN_INSTALL_REPOSITORY="/tmp/matrico" chicken-install -test
36-
CHICKEN_REPOSITORY_PATH="`chicken-install -repository`:/tmp/matrico" $(CSI) -e "(import matrico) (matrico-help)"
37-
38-
benchmark:
39-
@rm -f benchmark.txt
40-
make benchset DIM=125
41-
make benchset DIM=250
42-
make benchset DIM=500
43-
make benchset DIM=1000
44-
@cat benchmark.txt
45-
46-
benchset:
47-
@echo "## $(DIM):" >> benchmark.txt
48-
make benchrun LEVEL='-O0'
49-
make benchrun LEVEL='-O1'
50-
make benchrun LEVEL='-O2'
51-
make benchrun LEVEL='-O3'
52-
make benchrun LEVEL='-O4'
53-
make benchrun LEVEL='-O5'
54-
55-
benchrun:
42+
CHICKEN_INSTALL_REPOSITORY="/tmp/matrico" $(CHICKEN_INSTALL) -test
43+
CHICKEN_REPOSITORY_PATH="`$(CHICKEN_INSTALL) -repository`:/tmp/matrico" $(CSI) -e "(import matrico) (matrico-cite)"
44+
45+
iprofile:
46+
make matmul LEVEL='-O4' FLAGS='-profile' DIM=1000
47+
ls -1 PROFILE.* | sort -n | head -n1 | $(CHICKEN_PROFILE)
48+
49+
sprofile:
50+
make matmul LEVEL='-O4' DEBUG='-d3' DIM=1000 CLARG='-:P1000'
51+
ls -1 PROFILE.* | sort -n | head -n1 | $(CHICKEN_PROFILE)
52+
53+
matmul:LEVEL=-O5
54+
matmul:
5655
@echo "(include \"matrico.scm\") \
5756
(import matrico) \
58-
(time (mx-gram (mx-random $(DIM) $(DIM) -1.0 1.0))) \
59-
(exit)" | $(CSC) $(LEVEL) $(FLAGS) - -o /tmp/benchmark
60-
@/tmp/benchmark 2>> benchmark.txt
57+
(import (chicken time)) \
58+
(define A (mx-random $(DIM) $(DIM) -1.0 1.0)) \
59+
(define B (mx-random $(DIM) $(DIM) -1.0 1.0)) \
60+
(define t0 (current-seconds)) \
61+
(define C (time (mx-dot* A B))) \
62+
(define t1 (current-seconds)) \
63+
(print "Megaflops:" #\space (/ (* $(DIM) $(DIM) $(DIM)) (* (- t1 t0) 1000.0 1000.0))) \
64+
(newline) \
65+
(exit)" | $(CSC) $(LEVEL) $(FLAGS) - -o /tmp/matmul
66+
@/tmp/matmul $(CLARG) 2> matmul.txt
67+
@cat matmul.txt
6168

69+
linpack:LEVEL=-O5
6270
linpack:
6371
@echo "(include \"matrico.scm\") \
6472
(import matrico) \
@@ -68,12 +76,16 @@ linpack:
6876
(define t0 (current-seconds)) \
6977
(define solver (time (mx-solver A))) \
7078
(define t1 (current-seconds)) \
71-
(print "Megaflops/s:" #\space (/ (* $(DIM) $(DIM) $(DIM)) (* (- t1 t0) 1000.0 1000.0))) \
79+
(print "Megaflops:" #\space (/ (* $(DIM) $(DIM) $(DIM)) (* (- t1 t0) 1000.0 1000.0))) \
7280
(print "Residual:" #\space (mx-norm (mx- (solver b) 1.0) 2)) \
73-
(exit)" | $(CSC) -O5 $(FLAGS) - -o /tmp/linpack
74-
@/tmp/linpack 2> linpack.txt
81+
(newline) \
82+
(exit)" | $(CSC) $(LEVEL) $(FLAGS) - -o /tmp/linpack
83+
@/tmp/linpack $(CLARG) 2> linpack.txt
7584
@cat linpack.txt
7685

7786
clean:
78-
rm -f benchmark.txt linpack.txt matrico.so matrico.import.scm matrico-$(VERSION).tar.gz
87+
rm -f test.csv test.mx linpack.txt matmul.txt \
88+
matrico.so matrico.import.scm matrico.import.so matrico.static.o \
89+
matrico.build.sh matrico.install.sh matrico.link matrico.static.so \
90+
matrico-$(VERSION).tar.gz
7991

0 commit comments

Comments
 (0)