aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-23 18:14:40 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-23 18:28:28 -0700
commitd69f425ab33c3cce1979024421dcde6a02218914 (patch)
treea06a22eb17f7c500e6b7117c2e6abfaf91609ec7
parentd9b385883799f8ec5b8d3646276536d580c436ff (diff)
simplify chunk size determination in emscripten.py
-rwxr-xr-xemscripten.py4
-rw-r--r--tests/test_other.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/emscripten.py b/emscripten.py
index 4d744fdd..19e2160d 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -39,7 +39,7 @@ def scan(ll, settings):
if len(blockaddrs) > 0:
settings['NECESSARY_BLOCKADDRS'] = blockaddrs
-NUM_CHUNKS_PER_CORE = 1.25
+NUM_CHUNKS_PER_CORE = 1.0
MIN_CHUNK_SIZE = 1024*1024
MAX_CHUNK_SIZE = float(os.environ.get('EMSCRIPT_MAX_CHUNK_SIZE') or 'inf') # configuring this is just for debugging purposes
@@ -209,7 +209,7 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
if cores > 1:
intended_num_chunks = int(round(cores * NUM_CHUNKS_PER_CORE))
chunk_size = max(MIN_CHUNK_SIZE, total_ll_size / intended_num_chunks)
- chunk_size += 3*len(meta) + len(forwarded_data)/3 # keep ratio of lots of function code to meta (expensive to process, and done in each parallel task) and forwarded data (less expensive but potentially significant)
+ chunk_size += 3*len(meta) # keep ratio of lots of function code to meta (expensive to process, and done in each parallel task)
chunk_size = min(MAX_CHUNK_SIZE, chunk_size)
else:
chunk_size = MAX_CHUNK_SIZE # if 1 core, just use the max chunk size
diff --git a/tests/test_other.py b/tests/test_other.py
index 56c13650..9f331439 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -1665,10 +1665,10 @@ f.close()
if multiprocessing.cpu_count() < 2: return self.skip('need multiple cores')
try:
os.environ['EMCC_DEBUG'] = '1'
- os.environ['EMCC_CORES'] = '2'
+ os.environ['EMCC_CORES'] = '2' # standardize over machines
for asm, linkable, chunks, js_chunks in [
- (0, 0, 3, 2), (0, 1, 3, 4),
- (1, 0, 3, 2), (1, 1, 3, 4)
+ (0, 0, 2, 2), (0, 1, 2, 4),
+ (1, 0, 2, 2), (1, 1, 2, 4)
]:
print asm, linkable, chunks, js_chunks
output, err = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_libcxx.cpp'), '-O1', '-s', 'LINKABLE=%d' % linkable, '-s', 'ASM_JS=%d' % asm] + (['-O2'] if asm else []), stdout=PIPE, stderr=PIPE).communicate()