emscripten-core / emscripten-core/emscripten

OpenMP does not work on WASM64

Open
#27,221 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Please include the following in your bug report:

**Version of emscripten/emsdk:**
```
kengc@dd-kengchew:~$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 5.0.2 (dc80f645ee70178c11666de0c3860d9e064d50e4)
clang version 23.0.0git (https:/github.com/llvm/llvm-project 58f4da463e5b3cd3531cace17cc3f2d8d860964e)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/kengc/emsdk/upstream/bin
```
OpenMP implemented in this PR
https://github.com/emscripten-core/emscripten/pull/27073

**Failing command line in full:**
Failing the `test_openmp_max_threads` on `test-wasm64-4gb`/`test_core.wasm64_4gb`

**Full link command and output with `-v` appended:**

```
======================================================================
FAIL [0.001s]: test_openmp_max_threads (test_core.wasm64_4gb)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/project/test/common.py", line 1256, in run_process
rtn = utils.run_process(cmd, check=check, **kwargs)
File "/root/project/tools/utils.py", line 45, in run_process
ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
File "/usr/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/root/project/em++', 'src.cpp', '-o', 'src.js', '-sNO_DEFAULT_TO_CXX', '-sINITIAL_MEMORY=4200mb', '-sGLOBAL_BASE=4gb', '-Wclosure', '-Werror', '-Wno-limited-postlink-optimizations', '-m64', '--profiling-funcs', '-Wno-unused-command-line-argument', '-fopenmp=libomp']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/project/test/decorators.py", line 43, in decorated
return func(self, *args, **kwargs)
File "/root/project/test/test_core.py", line 5628, in test_openmp_max_threads
self.do_run(src, "", cflags=["-fopenmp=libomp"])
File "/root/project/test/common.py", line 1434, in do_run
return self._build_and_run(filename, expected_output, **kwargs)
File "/root/project/test/common.py", line 1466, in _build_and_run
js_file = self.build(filename, **kwargs)
File "/root/project/test/common.py", line 953, in build
self.run_process(cmd, stderr=self.stderr_redirect if not DEBUG else None)
File "/root/project/test/common.py", line 1261, in run_process
self.fail(f'subprocess exited with non-zero return code({e.returncode}): `{shlex.join(cmd)}`')
AssertionError: subprocess exited with non-zero return code(1): `/root/project/em++ src.cpp -o src.js -sNO_DEFAULT_TO_CXX -sINITIAL_MEMORY=4200mb -sGLOBAL_BASE=4gb -Wclosure -Werror -Wno-limited-postlink-optimizations -m64 --profiling-funcs -Wno-unused-command-line-argument -fopenmp=libomp`
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.