Skip to content

Commit 862018b

Browse files
authored
Avoid building Julia and use the standard julia action (#83)
* Avoid building Julia and use the standard julia action * Fix the way Julia is called in the Makefile * Rename LICENSE -> LICENSE.md --------- Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com>
1 parent cbde0ea commit 862018b

File tree

6 files changed

+31
-51
lines changed

6 files changed

+31
-51
lines changed

.github/workflows/benchmarks.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
matrix:
2828
os: [ubuntu-latest]
2929
java-version: ['24']
30-
julia-version: ['1.11.6']
30+
julia-version: ['1'] # Note: use the latest Julia version
3131
python-version: ['3.13']
3232
numpy-version: ['2.3']
3333
gfortran-version: ['14.2'] # Note: unused since is built-in.
@@ -41,26 +41,24 @@ jobs:
4141
- uses: actions/checkout@v4
4242
with:
4343
persist-credentials: false
44+
- name: "Set up Julia"
45+
uses: julia-actions/setup-julia@v2
46+
with:
47+
ref: v${{ matrix.julia-version }}
4448
- name: "Cache Julia"
4549
id: cache-julia
46-
uses: actions/cache@v4
50+
uses: julia-actions/cache@v2
4751
with:
48-
path: ~/julia
4952
key: ${{ runner.os }}-v${{ matrix.julia-version }}
50-
- name: "Build Julia"
51-
if: steps.cache-julia.outputs.cache-hit != 'true'
52-
uses: julia-actions/build-julia@v1
53-
with:
54-
ref: v${{ matrix.julia-version }}
5553
- name: "Set up dSFMT"
5654
run: |
57-
cd ~/
5855
mkdir -p dSFMT
5956
cd dSFMT
60-
wget https://github.com/MersenneTwister-Lab/dSFMT/archive/refs/tags/v2.2.4.tar.gz
57+
wget -q https://github.com/MersenneTwister-Lab/dSFMT/archive/refs/tags/v2.2.4.tar.gz
6158
echo "39682961ecfba621a98dbb6610b6ae2b7d6add450d4f08d8d4edd0e10abd8174 v2.2.4.tar.gz" | sha256sum --check --status
6259
tar -xzf v2.2.4.tar.gz
6360
mv dSFMT-*/* ./
61+
cd ..
6462
- name: "Set up OpenBLAS"
6563
run: |
6664
sudo apt-get install -y libopenblas-dev
@@ -98,6 +96,6 @@ jobs:
9896
# go-version: ${{ matrix.go-version }}
9997
- name: "Run benchmark"
10098
run: |
101-
JULIAHOME=~/julia DSFMTDIR=~/dSFMT/ make gh_action_benchmarks.html
99+
make gh_action_benchmarks.html
102100
- name: "Print benchmark data"
103101
run: cat gh_action_benchmarks.csv
File renamed without changes.

Makefile

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
ifndef JULIAHOME
2-
$(error JULIAHOME not defined. Set value to the root of the Julia source tree.)
3-
endif
4-
ifndef DSFMTDIR
5-
$(error DSFMTDIR not defined. Set value to the root of the dSFMT source tree.)
6-
endif
7-
8-
91
# Will make multi-line targets work
102
# (so we can use @for on the second line)
113
.ONESHELL:
124

13-
include $(JULIAHOME)/Make.inc
14-
include $(JULIAHOME)/deps/*.version
15-
165
NODEJSBIN = node
176

187
ITERATIONS=$(shell seq 1 5)
198

20-
#Use python2 for Python 2.x
219
PYTHON = python3
2210

2311
OCTAVE = octave-cli
@@ -39,30 +27,26 @@ endif
3927
FFLAGS+= -static-libgfortran
4028
endif
4129

42-
#Which libm library am I using?
43-
LIBMDIR = $(JULIAHOME)/usr/lib/
44-
ifeq ($(USE_SYSTEM_LIBM), 0)
45-
ifeq ($(USE_SYSTEM_OPENLIBM), 0)
46-
LIBM = $(LIBMDIR)libopenlibm.a
47-
endif
48-
endif
49-
5030
default: benchmarks.html
5131

5232
export OMP_NUM_THREADS=1
53-
export GOTO_NUM_THREADS=1
5433
export OPENBLAS_NUM_THREADS=1
5534

56-
perf.h: $(JULIAHOME)/deps/*.version
57-
echo '#include "cblas.h"' > $@
58-
echo '#include "$(DSFMTDIR)/dSFMT.c"' >> $@
35+
dsfmt:
36+
mkdir -p dSFMT
37+
cd dSFMT
38+
wget -q https://github.com/MersenneTwister-Lab/dSFMT/archive/refs/tags/v2.2.4.tar.gz
39+
echo "39682961ecfba621a98dbb6610b6ae2b7d6add450d4f08d8d4edd0e10abd8174 v2.2.4.tar.gz" | sha256sum --check --status
40+
tar -xzf v2.2.4.tar.gz
41+
mv dSFMT-*/* ./
42+
cd ..
5943

60-
bin/perf%: perf.c perf.h
61-
$(CC) -std=c99 -O$* $< -o $@ -I$(DSFMTDIR) -lopenblas -L$(LIBMDIR) $(LIBM) $(CFLAGS) -lpthread
44+
bin/perf%: perf.c
45+
$(CC) -std=c99 -O$* $< -o $@ -IdSFMT -lopenblas -lm $(CFLAGS) -lpthread
6246

6347
bin/fperf%: perf.f90
6448
mkdir -p mods/$@ #Modules for each binary go in separate directories
65-
$(FC) $(FFLAGS) -Jmods/$@ -O$* $< -o $@ -lopenblas -L$(LIBMDIR) $(LIBM) -lpthread
49+
$(FC) $(FFLAGS) -Jmods/$@ -O$* $< -o $@ -lopenblas -lm -lpthread
6650

6751
benchmarks/c.csv: \
6852
benchmarks/c0.csv \
@@ -78,7 +62,6 @@ benchmarks/fortran.csv: \
7862
benchmarks/fortran3.csv
7963
cat $^ > $@
8064

81-
8265
benchmarks/c%.csv: bin/perf%
8366
@for t in $(ITERATIONS); do $<; done >$@
8467

@@ -87,14 +70,14 @@ benchmarks/fortran%.csv: bin/fperf%
8770

8871
benchmarks/go.csv: export GOPATH=$(abspath gopath)
8972
benchmarks/go.csv: perf.go
90-
export CGO_LDFLAGS="-L${LIBM} -lopenblas"
73+
export CGO_LDFLAGS="-lopenblas"
9174
go install gonum.org/v1/netlib/blas/netlib@latest
9275
go install gonum.org/v1/gonum/mat64@latest
9376
go install gonum.org/v1/gonum/stat@latest
9477
@for t in $(ITERATIONS); do go run $<; done >$@
9578

9679
benchmarks/julia.csv: perf.jl
97-
@for t in $(ITERATIONS); do $(JULIAHOME)/usr/bin/julia $<; done >$@
80+
@for t in $(ITERATIONS); do julia $<; done >$@
9881

9982
benchmarks/python.csv: perf.py
10083
@for t in $(ITERATIONS); do $(PYTHON) $<; done >$@
@@ -150,19 +133,19 @@ gh_action_versions.csv: bin/versions.sh
150133
$^ $(COLON_SEPARATED_GHA_LANGUAGES) >$@
151134

152135
benchmarks.csv: bin/collect.jl $(BENCHMARKS)
153-
@$(call PRINT_JULIA, $^ >$@)
136+
julia $^ >$@
154137

155138
gh_action_benchmarks.csv: bin/collect.jl $(GH_ACTION_BENCHMARKS)
156-
@$(call PRINT_JULIA, $^ >$@)
139+
julia $^ >$@
157140

158141
benchmarks.html: bin/table.jl versions.csv benchmarks.csv
159-
@$(call PRINT_JULIA, $^ >$@)
142+
julia $^ >$@
160143

161144
gh_action_benchmarks.html: bin/table.jl gh_action_versions.csv gh_action_benchmarks.csv
162-
@$(call PRINT_JULIA, $^ >$@)
145+
julia $^ >$@
163146

164147
clean:
165-
@rm -rf perf.h bin/perf* bin/fperf* benchmarks/*.csv benchmarks.csv mods *~ octave-core perf.log gopath/*
148+
@rm -rf bin/perf* bin/fperf* benchmarks/*.csv benchmarks.csv mods *~ octave-core perf.log gopath/*
166149

167150
.PHONY: all perf clean
168151

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ The results of these benchmarks are used to generate the performance graph on th
88

99
## Running benchmarks
1010

11-
This repository assumes that Julia has been built from source and that there exists
12-
an environment variable `JULIAHOME` that points to the root of the Julia source tree.
13-
This can also be set when invoking `make`, e.g. `make JULIAHOME=path/to/julia`.
11+
Install Julia with `juliaup`.
1412

1513
To build binaries and run the benchmarks, simply run `make`.
1614
Note that this refers to GNU Make, so BSD users will need to run `gmake`.

bin/versions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fi
3434

3535
if [[ $LANGUAGES == *":julia:"* ]]; then
3636
echo -n "julia,"
37-
$JULIAHOME/usr/bin/julia -v | cut -f3 -d" "
37+
julia -v | cut -f3 -d" "
3838
fi
3939

4040
if [[ $LANGUAGES == *":lua:"* ]]; then

perf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
// include header file generated by make:
66
#define DSFMT_MEXP 19937
7-
#include "perf.h"
7+
#include "cblas.h"
8+
#include "dSFMT.c"
89
#include "randmtzig.c"
910

1011
double *myrand(int n) {

0 commit comments

Comments
 (0)