Comments (10)
OK I have successfully compiling and running the code with emscripten. You have to:
- Change all the
.cu
files to.cpp
. (actually not sure if this is needed, but I need to do this to use clang++ to build the project instead of using nvcc) - Comment out modules that uses libraries that you don't plan to deal with now, e.g. assimp. I think we should be able to use this, but I am too lazy to deal with it now.
- Set include path to thrust and glm explicitly in the CMakeLists.txt, otherwise emscripten won't be able to find them.
- Specify emscripten toolchain file:
CMAKE_TOOLCHAIN_FILE=path/to/emscripten/emscripten/version/cmake/Modules/Platform/Emscripten.cmake
(from https://github.com/adevaykin/minimal-cmake-emscripten-project) - Build with
MANIFOLD_USE_CPP=on
.
You may want to build with -DCMAKE_CXX_FLAGS="-s ALLOW_MEMORY_GROWTH=1"
. I tried building without this argument and the perfTest failed with out of memory error. Not sure if this is the appropriate way to do this because em++ is complaining about linker setting ignored during compilation, but at the end it seems working.
from manifold.
I certainly don't, but having an emscripten build would be awesome! Feel free to open a draft PR with what you've tried so we can follow along.
from manifold.
Yes this can be integrated into the CMake script and test it on GitHub Actions CI, but this requires some modifications:
- Change all
.cu
files to.cpp
. I think we can still getnvcc
to treat them as CUDA source files byset_source_files_properties(${CUDA_SOURCES} PROPERTIES LANGUAGE CUDA)
, haven't yet tried this though. - We may need to put the dependencies as git submodules in the
third_party
directory, or ask users to specify the path to these dependencies manually via CMake variables when compiling with emscripten. I tried usingfind_package
for packages like glm and thrust but this does not work, I am not familiar with CMake and C++ so not sure if I am doing this correctly.
Also, it will be nice if we can specify the gtest dependency as git a submodule rather than using CMake to download it. I can package this with NixOS for reproducible builds, but it forbids network connection for pure builds so CMake will not be able to download gtest from the web.
I just tried building assimp with emscripten and it seems that it builds fine out of the box for v5.2.3. Will try to link against it and do some tests.
from manifold.
Wondering if this is possible with nvcc. Probably easier after switching to C++20 parallel algorithms?
from manifold.
I think it's possible, this repo https://github.com/jstepien/boids seems to achieve it but i didn't try to compile it.
It will be easier indeed with c++ 20
from manifold.
It seems to me that the make file is compiling the cpu simulation to llvm IR using clang, and then use emscripten to compile the LLVM IR to JavaScript. I don't think nvcc can emit LLVM IR (at least I don't see an option for this).
from manifold.
You can build this library without nvcc, as long as you're not targeting the CUDA backend. Thrust is just a header-only C++ lib. That may be a path forward.
What I'd really love to see is emscripten taking C++20 parallel algorithms and converting them to GPU-accelerated WASM (WebGPU?). I would imagine someone somewhere is thinking about that, but I have no idea if/when it might ship.
from manifold.
I've tried using the OpenMP backend and CUDA backend for some tests, it seems that CUDA is quite fast for some larger meshes comparing to OpenMP (which is expected). Wondering if GPU acceleration will be dropped if the goal is to switch to c++ 20 parallel algorithms later.
from manifold.
Yes, GPU parallelization is definitely a goal of this library, and I should really be saying C++17, not C++20. std::execution::par
targets GPUs, and eventually more of them than CUDA.
from manifold.
That's awesome! Fantastic work. It would be great to integrate that into our CMake scripts somehow, maybe even get it building/testing on our Github Actions CI?
from manifold.
Related Issues (20)
- Python created object reports as non-manifold. HOT 3
- Watertightness of Mesh with an Edge Shared by 4 Faces
- vertex halfedge iterator
- Manifold 2.4.5 release tar.gz is incomplete HOT 3
- Vec out of Range HOT 8
- Python binding needs two import call HOT 4
- Manifold Decompose doesn't preserve vertex properties HOT 4
- memory leak when TBB and PSTL is enabled HOT 27
- Triangulate bug: Two separate polygons HOT 5
- [Question] robust geometric predicates, polygon triangulation
- Warning comparison of integer expressions of different signedness
- Modularize Manifold HOT 25
- Build without exceptions HOT 3
- Remove Thrust HOT 19
- How to figure out required size of mem in the C-API? HOT 1
- Crash in Project() HOT 4
- gcc14 build failure HOT 7
- Triangulation issue: Zebra HOT 3
- BSD compiler error HOT 1
- Another Zebra Triangulation issue HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manifold.