Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodingwizard committed Jul 9, 2024
1 parent bb1eeee commit 8410a14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ RUN dnf install -y libasan libubsan
# Precompile bits/stdc++.h: https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
# I believe flags like -Wall are ignored, but flags like -std, -O2, and -fsanitize=address must
# match the flags used to precompile the header.
RUN mkdir -p /precompiled-headers/bits/stdc++.h.gch
RUN g++ -std=c++11 -O2 -o /precompiled-headers/bits/stdc++.h.gch/01 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++17 -O2 -o /precompiled-headers/bits/stdc++.h.gch/02 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++23 -O2 -o /precompiled-headers/bits/stdc++.h.gch/03 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++11 -O2 -fsanitize=address -o /precompiled-headers/bits/stdc++.h.gch/04 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++17 -O2 -fsanitize=address -o /precompiled-headers/bits/stdc++.h.gch/05 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++23 -O2 -fsanitize=address -o /precompiled-headers/bits/stdc++.h.gch/06 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN mkdir -p /var/runtime/task/precompiled-headers/bits/stdc++.h.gch
RUN g++ -std=c++11 -O2 -o /var/runtime/task/precompiled-headers/bits/stdc++.h.gch/01 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++17 -O2 -o /var/runtime/task/precompiled-headers/bits/stdc++.h.gch/02 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++23 -O2 -o /var/runtime/task/precompiled-headers/bits/stdc++.h.gch/03 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++11 -O2 -fsanitize=address -o /var/runtime/task/precompiled-headers/bits/stdc++.h.gch/04 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++17 -O2 -fsanitize=address -o /var/runtime/task/precompiled-headers/bits/stdc++.h.gch/05 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h
RUN g++ -std=c++23 -O2 -fsanitize=address -o /var/runtime/task/precompiled-headers/bits/stdc++.h.gch/06 /usr/include/c++/11/x86_64-amazon-linux/bits/stdc++.h

# ^ this takes 0.3s to compile. However, the initial compilation can take a lot longer than 5 seconds, presumably because lambda disk read speeds are very slow.
# I think maybe we try to compile this after execution or something.

RUN dnf install -y java-21-amazon-corretto-devel
RUN dnf install -y time
Expand Down
5 changes: 4 additions & 1 deletion src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ pub fn compile(compile_request: CompileRequest) -> Result<CompileResponse> {
"g++ -I/precompiled-headers -o {} {} program.cpp",
output_file_path, compile_request.compiler_options
);
let command = format!(
"mkdir /tmp && cp /var/runtime/task/precompiled-headers/bits/stdc++.h.gch/01 /tmp/01",
);
let compile_output = run_command(
&command,
tmp_dir.path(),
CommandOptions {
stdin: String::new(),
timeout_ms: 5000,
timeout_ms: 600000,
},
)?;

Expand Down

0 comments on commit 8410a14

Please sign in to comment.