Skip to content

Commit 24186e5

Browse files
committed
add support for julia (julialang.org)
this is experimental-only, since julia uses too much memory!
1 parent ac1c41a commit 24186e5

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ RUN apt-get update && \
1717
golang \
1818
ruby \
1919
mono-runtime \
20-
mono-mcs && \
20+
mono-mcs \
21+
axel && \
2122
python3 -m venv /venv && \
2223
bash -c "source /venv/bin/activate && \
2324
pip install -r /tmp/jd4/requirements.txt && \
@@ -27,6 +28,9 @@ RUN apt-get update && \
2728
rm -rf /var/lib/apt/lists/* && \
2829
mkdir -p /root/.config/jd4 && \
2930
cp /tmp/jd4/examples/langs.yaml /root/.config/jd4/langs.yaml && \
30-
rm -rf /tmp/jd4
31+
rm -rf /tmp/jd4 && \
32+
axel https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.0-linux-x86_64.tar.gz && \
33+
tar xf julia-1.0.0-linux-x86_64.tar.gz --strip-components=1 -C /usr && \
34+
rm julia-1.0.0-linux-x86_64.tar.gz
3135
CMD bash -c "source /venv/bin/activate && \
3236
python3 -m jd4.daemon"

examples/langs.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,8 @@ cs:
7979
code_file: foo.cs
8080
execute_file: /usr/bin/mono
8181
execute_args: mono foo.exe
82+
jl:
83+
type: interpreter
84+
code_file: foo.jl
85+
execute_file: /usr/bin/julia
86+
execute_args: julia foo.jl

jd4/case.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ def read_legacy_cases(config, open):
246246
num_cases = int(config.readline())
247247
for line in islice(csv.reader(config, delimiter='|'), num_cases):
248248
input, output, time_str, score_str = line[:4]
249-
try:
250-
memory_bytes = int(float(line[4]) * 1024)
251-
except (IndexError, ValueError):
252-
memory_bytes = DEFAULT_MEMORY_BYTES
249+
#try:
250+
# memory_bytes = int(float(line[4]) * 1024)
251+
#except (IndexError, ValueError):
252+
memory_bytes = DEFAULT_MEMORY_BYTES
253253
yield DefaultCase(partial(open, path.join('input', input)),
254254
partial(open, path.join('output', output)),
255255
int(float(time_str) * 1000000000),

jd4/integration_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ class Program {
125125
}
126126
}""")
127127

128+
def test_jl(self):
129+
self.do_lang('jl', b'println(sum(parse(Int, x) for x in split(readline())))')
130+
128131
class StatusTest(TestCase):
129132
@classmethod
130133
def setUpClass(cls):

0 commit comments

Comments
 (0)