Commit 1babc76d authored by Pierre Augier's avatar Pierre Augier
Browse files

set_compile_cachedjit

parent fd41debad5f7
from ._version import __version__
from .justintime import cachedjit, used_by_cachedjit
from .justintime import cachedjit, used_by_cachedjit, set_compile_cachedjit
try:
from ._path_data_tests import path_data_tests
......@@ -25,6 +25,7 @@ __all__ = [
"Shape",
"cachedjit",
"used_by_cachedjit",
"set_compile_cachedjit",
"set_pythranize_at_import",
"wait_for_all_extensions",
]
......@@ -23,6 +23,8 @@ Internal API
.. autofunction:: make_pythran_type_name
.. autofunction:: set_compile_cachedjit
Notes
-----
......@@ -56,6 +58,7 @@ import itertools
import os
import sys
import time
from distutils.util import strtobool
try:
import numpy as np
......@@ -86,6 +89,14 @@ path_cachedjit = path_root / "__cachedjit__"
path_cachedjit.mkdir(parents=True, exist_ok=True)
_COMPILE_CACHEDJIT = strtobool(os.environ.get("FLUID_COMPILE_CACHEDJIT", "True"))
def set_compile_cachedjit(value):
global _COMPILE_CACHEDJIT
_COMPILE_CACHEDJIT = value
class ModuleCachedJIT:
"""Representation of a module using cachedjit"""
......@@ -348,7 +359,7 @@ class CachedJIT:
ext_files = list(path_pythran.parent.glob(glob_name_ext_file))
if not ext_files:
if has_to_pythranize_at_import():
if has_to_pythranize_at_import() and _COMPILE_CACHEDJIT:
pythranize_with_new_header()
self.pythran_func = None
else:
......@@ -374,7 +385,7 @@ class CachedJIT:
# need to compiled or recompile
pass
if self.compiling:
if self.compiling or not _COMPILE_CACHEDJIT:
return func(*args, **kwargs)
arg_types = [
......
......@@ -58,15 +58,15 @@ class SchedulerPopen:
def __init__(self, parallel=True):
self.processes = []
if parallel:
self.nb_cpus = multiprocessing.cpu_count()
self.limit_nb_processes = max(1, multiprocessing.cpu_count() // 2)
else:
self.nb_cpus = 1
self.limit_nb_processes = 1
def launch_popen(self, words_command, cwd=None, parallel=True):
"""Launch a program (blocking if too many processes launched)"""
if parallel:
limit = self.nb_cpus
limit = self.limit_nb_processes
else:
limit = 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment