Skip to content

Commit

Permalink
Parallelization of kompile processes in foundry_kompile (#2010)
Browse files Browse the repository at this point in the history
* parallel foundry_kompile

* Set Version: 1.0.253

* add suggestion from review

* update log message

* Set Version: 1.0.254

* Set Version: 1.0.256

---------

Co-authored-by: devops <[email protected]>
  • Loading branch information
anvacaru and devops authored Aug 12, 2023
1 parent 51573ee commit df8fac3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion kevm-pyk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kevm-pyk"
version = "1.0.255"
version = "1.0.256"
description = ""
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down
29 changes: 20 additions & 9 deletions kevm-pyk/src/kevm_pyk/foundry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import concurrent.futures
import json
import logging
import os
Expand Down Expand Up @@ -43,6 +44,7 @@

if TYPE_CHECKING:
from collections.abc import Iterable
from concurrent.futures import Future
from typing import Any, Final

from pyk.kast.inner import KInner
Expand Down Expand Up @@ -476,20 +478,29 @@ def kompilation_up_to_date() -> bool:

return old_digest == kompilation_digest()

def kompile_haskell() -> None:
_LOGGER.info(f'Kompiling definition: {foundry_main_file}')
_kompile(foundry_definition_dir, KompileTarget.HASKELL)

def kompile_llvm() -> None:
_LOGGER.info(f'Kompiling definition to LLVM dynamic library: {foundry_main_file}')
_kompile(
foundry_llvm_dir,
KompileTarget.LLVM,
llvm_kompile_type=LLVMKompileType.C,
)

def update_kompilation_digest() -> None:
digest_file = foundry_definition_dir / 'digest'
digest_file.write_text(kompilation_digest())

if not kompilation_up_to_date() or rekompile or not kompiled_timestamp.exists():
_LOGGER.info(f'Kompiling definition: {foundry_main_file}')
_kompile(foundry_definition_dir, KompileTarget.HASKELL)
if llvm_library:
_LOGGER.info(f'Kompiling definition to LLVM dy.lib: {foundry_main_file}')
_kompile(
foundry_llvm_dir,
KompileTarget.LLVM,
llvm_kompile_type=LLVMKompileType.C,
)
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
futures: list[Future] = []
futures.append(executor.submit(kompile_haskell))
if llvm_library:
futures.append(executor.submit(kompile_llvm))
[future.result() for future in futures]

update_kompilation_digest()
foundry.update_digest()
Expand Down
2 changes: 1 addition & 1 deletion package/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
kevm (1.0.255) unstable; urgency=medium
kevm (1.0.256) unstable; urgency=medium

* Initial Release.

Expand Down
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.255
1.0.256

0 comments on commit df8fac3

Please sign in to comment.