Closed orangeSi closed 10 months ago
I can suggest two options. (a) The dependency on OMP is very easy to remove if you have any C/C++ skills, I can explain how to do this. (b) MUSCLE v3 is single-threaded and has no dependency on OMP, you could use that instead: https://drive5.com/muscle/downloads_v3.htm
ok,thanks~
(a) I only learn C and C++ lang
a few years ago~
by google, I just known should do these ( and If there are something more need to do ? ):
#pragma omp
+ header file #include <omp.h>
: This is easy to do for meremove some function of OMP
, example omp_get_thread_num
: this will take some time to do for me,
Could you explain some guideline? example how to remove some function of OMP
? (b) I had compile MUSCLE v3.8.1551
to wasm successfully, and will pulibsh it at https://github.com/biowasm/biowasm
by github PR after some days, and I still want to try lastest V5 just.
Removing the lines with #pragma omp
is ok, but should not be necessary because a compiler which does not support OMP should ignore them.
The basic idea is to make a fake OMP library that is running just one thread.
Replace #include <omp.h>
with #include of your own header file which defines a macro or stub funtion for all the omp_* functions used in the source code. You can make a list of these functions by making an empty header file and looking at the error messages.
Most of the omp_* functions can be replaced by do-nothing macros in your new header file, e.g. all functions related to locking:
#define omp_init_lock(x) /* do nothing */
#define omp_set_lock(x) /* do nothing */
#define omp_lock_lock(x) /* do nothing */
omp_get_num_threads()
should return 1, e.g. as a macro:
#define get_num_threads(x) 1
omp_get_thread_num()
should return 0 (one thread with zero-based indexing), e.g. as a macro:
#define get_thread_num(x) 0
thanks a lot~ I will try this way to write a fake omp.h
!
I make a fake omp.h
as below, and compile with -fno-openmp
+ add a fake GetPhysMemBytes
, then it works! now I am submiting a PR to public the wasm file of Muscle V5
by https://github.com/biowasm/biowasm/pull/81.
#define omp_init_lock(x) /* do nothing */
#define omp_set_lock(x) /* do nothing */
#define omp_unset_lock(x) /* do nothing */
#define omp_lock_lock(x) /* do nothing */
typedef void *omp_lock_t;
#define omp_get_num_threads(x) 1
#define omp_get_thread_num(x) 0
#define omp_get_max_threads(x) 1
thanks ~
@rcedgar If compile to unknown target(example above webassembly), need add a fake GetPhysMemBytes.
So I make a PR at https://github.com/rcedgar/muscle/pull/68, If that PR is not appropriate, I will close that PR, please let me known, thanks a lot ~
@rcedgar I compiled Muscle V5
to webassembly
to use it in web browser, and release the wasm at https://biowasm.com/cdn/v3/muscle/5.1.0, thanks the guideline about fake omp.h
!
muscle v3.8.1551
is also compiled to wasm to use in web browser at https://biowasm.com/cdn/v3/muscle/3.8.1551
Hi Robert, The openmp(
omp.h
) is a dependence of Muscle V5, so if is possible give a version which removed the dependence ofomp.h
? I want to compileMuscle V5
towebassembly
by https://github.com/emscripten-core/emscripten for useMuscle V5
in Web Browser, butemscripten
still not support openmp(omp.h
) and maybe continue for a long time.Thanks~