Skip to content

Commit

Permalink
Write Generated Kernel Files to Disk (#19)
Browse files Browse the repository at this point in the history
- Write each benchmark's source code in `benchmarks_source_code` folder for easier inspection
  • Loading branch information
iomaganaris committed Jun 24, 2024
1 parent 0ada520 commit 0a47c0f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion stencil_benchmarks/tools/compilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import ctypes
import io
import os
import pathlib
import subprocess
import tempfile
from typing import (Any, Callable, Iterator, List, Optional, TextIO, Tuple,
Expand Down Expand Up @@ -126,7 +127,10 @@ def __init__(self,
else:
compile_command += ['-shared', '-fPIC']

with tempfile.NamedTemporaryFile(suffix=extension) as srcfile:
output_dir = pathlib.Path("benchmarks_source_code")
output_dir.mkdir(exist_ok=True)

with tempfile.NamedTemporaryFile(suffix=extension, dir=output_dir, delete=False) as srcfile:
srcfile.write(code.encode())
srcfile.flush()

Expand Down

0 comments on commit 0a47c0f

Please sign in to comment.