emscripten - disable multithreading

This commit is contained in:
Matthias Hochsteger 2023-08-22 09:27:03 +02:00
parent b30b33e8a8
commit 9e4659f194
3 changed files with 3 additions and 12 deletions

View File

@ -18,10 +18,7 @@ string(REPLACE "|" ";" ng_compile_flags_replace_sep "${NG_COMPILE_FLAGS}")
target_compile_options(ngcore PUBLIC ${ng_compile_flags_replace_sep}) target_compile_options(ngcore PUBLIC ${ng_compile_flags_replace_sep})
if(EMSCRIPTEN) if(EMSCRIPTEN)
target_link_options(ngcore PUBLIC -sALLOW_MEMORY_GROWTH) target_link_options(nglib PUBLIC -sALLOW_MEMORY_GROWTH -sENVIRONMENT=web)
# target_link_options(ngcore PUBLIC -sINITIAL_MEMORY=1gb)
target_link_options(ngcore PUBLIC -pthread -sPTHREAD_POOL_SIZE=16)
target_compile_options(ngcore PUBLIC -pthread)
endif() endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)

View File

@ -76,14 +76,14 @@ namespace ngcore
numa_run_on_node (0); numa_run_on_node (0);
#endif #endif
#ifndef WIN32 #if !defined(WIN32) && !defined(EMSCRIPTEN)
// master has maximal priority ! // master has maximal priority !
int policy; int policy;
struct sched_param param; struct sched_param param;
pthread_getschedparam(pthread_self(), &policy, &param); pthread_getschedparam(pthread_self(), &policy, &param);
param.sched_priority = sched_get_priority_max(policy); param.sched_priority = sched_get_priority_max(policy);
pthread_setschedparam(pthread_self(), policy, &param); pthread_setschedparam(pthread_self(), policy, &param);
#endif // WIN32 #endif // !defined(WIN32) && !defined(EMSCRIPTEN)
task_manager->StartWorkers(); task_manager->StartWorkers();

View File

@ -9,11 +9,5 @@ target_link_libraries(nglib PUBLIC ngcore)
target_link_libraries( nglib PRIVATE ${MPI_CXX_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} ${OCC_LIBRARIES} netgen_cgns ) target_link_libraries( nglib PRIVATE ${MPI_CXX_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} ${OCC_LIBRARIES} netgen_cgns )
if(EMSCRIPTEN)
target_link_options(nglib PUBLIC -sALLOW_MEMORY_GROWTH)
target_link_options(nglib PUBLIC -pthread -sPTHREAD_POOL_SIZE=16)
target_compile_options(nglib PUBLIC -pthread)
endif(EMSCRIPTEN)
install(TARGETS nglib netgen_cgns ${NG_INSTALL_DIR}) install(TARGETS nglib netgen_cgns ${NG_INSTALL_DIR})
install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel) install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel)