Skip to content

Commit 336eb5e

Browse files
authored
feat: codon lang (hanabi1224#338)
1 parent ec16858 commit 336eb5e

File tree

6 files changed

+37
-2
lines changed

6 files changed

+37
-2
lines changed

.github/codon.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/bash
2+
3+
/usr/bin/bash -c "$(curl -fsSL https://exaloop.io/install.sh)"
4+
sudo ln -sf ~/.codon/bin/codon /usr/local/bin/codon
5+
codon --version

.github/workflows/bench.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
acton,
2121
c,
2222
chapel,
23+
codon,
2324
cpp,
2425
csharp,
2526
crystal,
@@ -72,6 +73,9 @@ jobs:
7273
- name: Install acton
7374
if: matrix.lang == 'acton'
7475
run: ./.github/acton.sh
76+
- name: Install codon
77+
if: matrix.lang == 'codon'
78+
run: ./.github/codon.sh
7579
- name: Install rust stable
7680
uses: actions-rs/toolchain@v1
7781
if: matrix.lang == 'rust' || matrix.lang == 'wasm'
@@ -260,6 +264,7 @@ jobs:
260264
dotnet run -c Release --project tool -- --task checkcpu
261265
popd
262266
- run: ./.github/acton.sh
267+
- run: ./.github/codon.sh
263268
- run: ./.github/clang.sh
264269
- run: ./.github/crystal.sh
265270
- run: ./.github/dotnet.sh

bench/algorithm/nbody/1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def report_energy(bodies=SYSTEM, pairs=PAIRS, e=0.0):
9595
e -= (m1 * m2) / ((dx * dx + dy * dy + dz * dz) ** 0.5)
9696
for (r, [vx, vy, vz], m) in bodies:
9797
e += m * (vx * vx + vy * vy + vz * vz) / 2.
98-
print("%.9f" % e)
98+
print(f"{e:.9f}")
9999

100100

101101
def offset_momentum(ref, bodies=SYSTEM, px=0.0, py=0.0, pz=0.0):

bench/algorithm/nbody/2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def report_energy(bodies=SYSTEM, e=0.0):
9090
dz = b1.z - b2.z
9191
distance = math.sqrt(dx*dx + dy*dy + dz*dz)
9292
e -= b1.m * b2.m / distance
93-
print("%.9f" % e)
93+
print(f"{e:.9f}")
9494

9595

9696
def offset_momentum(ref, bodies=SYSTEM, px=0.0, py=0.0, pz=0.0):

bench/algorithm/regex-redux/1.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from re import sub, findall
1313

1414

15+
seq = None
16+
1517
def init(arg):
1618
global seq
1719
seq = arg

bench/bench_codon.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
lang: codon
2+
problems:
3+
- name: helloworld
4+
source:
5+
- 1.py
6+
- name: nbody
7+
source:
8+
- 1.py
9+
- name: nsieve
10+
source:
11+
- 1.py
12+
- 2.py
13+
source_rename_to: app.codon
14+
environments:
15+
- os: linux
16+
compiler: codon
17+
compiler_version_command: codon --version
18+
version: latest
19+
build: codon build --release --cost-kind=latency --exe app.codon
20+
after_build:
21+
- mv app out
22+
out_dir: out
23+
run_cmd: app

0 commit comments

Comments
 (0)