Skip to content

Commit

Permalink
remove elalish#1045 related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pca006132 committed Nov 17, 2024
1 parent 4fdba84 commit f02edbb
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manifold.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
variant: [manifold-none, manifold-tbb, manifold-js, manifold-js-tbb, manifold3d]
variant: [manifold-none, manifold-tbb, manifold-js, manifold3d]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
26 changes: 0 additions & 26 deletions bindings/wasm/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,6 @@
#include "manifold/manifold.h"
#include "manifold/polygon.h"

#if (MANIFOLD_PAR == 1)
#include <tbb/parallel_for.h>

#include <atomic>
#endif

void initTBB() {
#if (MANIFOLD_PAR == 1)
int num_threads = tbb::this_task_arena::max_concurrency();
std::atomic<int> barrier{num_threads};
tbb::parallel_for(
0, num_threads,
[&barrier](int) {
barrier--;
while (barrier > 0) {
// Send browser thread to event loop
std::this_thread::yield();
}
},
tbb::static_partitioner{});
#endif
}

using namespace emscripten;
using namespace manifold;

Expand Down Expand Up @@ -218,7 +195,4 @@ EMSCRIPTEN_BINDINGS(whatever) {
function("setCircularSegments", &Quality::SetCircularSegments);
function("getCircularSegments", &Quality::GetCircularSegments);
function("resetToCircularDefaults", &Quality::ResetToDefaults);

// https://github.com/oneapi-src/oneTBB/blob/master/WASM_Support.md#limitations
function("initTBB", &initTBB);
}
3 changes: 0 additions & 3 deletions bindings/wasm/bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ Module.setup = function() {
if (_ManifoldInitialized) return;
_ManifoldInitialized = true;

// warmup tbb for emscripten, according to
// https://github.com/oneapi-src/oneTBB/blob/master/WASM_Support.md#limitations
Module.initTBB();
// conversion utilities

function toVec(vec, list, f = x => x) {
Expand Down
5 changes: 0 additions & 5 deletions bindings/wasm/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,3 @@ To use the manifoldCAD.org editor (`npm run dev`), you'll likely have to set
discussion of the
[issue#328](https://github.com/elalish/manifold/issues/328#issuecomment-1473847102)
of this repository.

## Fixing Vite Static Worker Option Error

Run `fixup.sh` in `bindings/wasm`.

6 changes: 0 additions & 6 deletions bindings/wasm/examples/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ export default defineConfig({
worker: {
format: 'es',
},
server: {
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin',
},
},
build: {
target: 'esnext',
sourcemap: true,
Expand Down
3 changes: 0 additions & 3 deletions bindings/wasm/fixup.sh

This file was deleted.

2 changes: 1 addition & 1 deletion bindings/wasm/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Manifold SetProperties(Manifold& manifold, int numProp, uintptr_t funcPtr) {
Manifold LevelSet(uintptr_t funcPtr, Box bounds, double edgeLength,
double level, double tolerance) {
double (*f)(const vec3&) = reinterpret_cast<double (*)(const vec3&)>(funcPtr);
return Manifold::LevelSet(f, bounds, edgeLength, level, tolerance, false);
return Manifold::LevelSet(f, bounds, edgeLength, level, tolerance);
}

std::vector<Manifold> Split(Manifold& a, Manifold& b) {
Expand Down
14 changes: 4 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
cd ../
'';
};
manifold-emscripten = { parallel, doCheck ? true }: pkgs.buildEmscriptenPackage {
manifold-emscripten = { doCheck ? true }: pkgs.buildEmscriptenPackage {
name = "manifold-js";
version = manifold-version;
src = self;
Expand All @@ -126,10 +126,8 @@
mkdir build
cd build
emcmake cmake -DCMAKE_BUILD_TYPE=Release \
-DMANIFOLD_PAR=${if parallel then "ON" else "OFF"} \
-DFETCHCONTENT_SOURCE_DIR_GOOGLETEST=${gtest-src} \
-DFETCHCONTENT_SOURCE_DIR_CLIPPER2=../clipper2 \
${if parallel then "-DFETCHCONTENT_SOURCE_DIR_TBB=${onetbb-src}" else ""} ..
-DFETCHCONTENT_SOURCE_DIR_CLIPPER2=../clipper2 ..
'';
buildPhase = ''
emmake make -j''${NIX_BUILD_CORES}
Expand All @@ -149,12 +147,7 @@
packages = {
manifold-tbb = manifold { };
manifold-none = manifold { parallel = false; };
manifold-js = manifold-emscripten { parallel = false; };
# disable check for now
manifold-js-tbb = manifold-emscripten {
parallel = true;
doCheck = false;
};
manifold-js = manifold-emscripten { };
# but how should we make it work with other python versions?
manifold3d = with pkgs.python3Packages; buildPythonPackage {
pname = "manifold3d";
Expand Down Expand Up @@ -199,6 +192,7 @@
gtest
assimp
clipper2
pkg-config

# useful tools
clang-tools_18
Expand Down
21 changes: 0 additions & 21 deletions test/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
#define FrameMarkEnd(x)
#endif

#if (MANIFOLD_PAR == 1)
#include <tbb/parallel_for.h>
#endif

using namespace manifold;

Options options;
Expand All @@ -46,23 +42,6 @@ void print_usage() {
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);

// warmup tbb for emscripten, according to
// https://github.com/oneapi-src/oneTBB/blob/master/WASM_Support.md#limitations
#if defined(__EMSCRIPTEN__) && (MANIFOLD_PAR == 1)
int num_threads = tbb::this_task_arena::max_concurrency();
std::atomic<int> barrier{num_threads};
tbb::parallel_for(
0, num_threads,
[&barrier](int) {
barrier--;
while (barrier > 0) {
// Send browser thread to event loop
std::this_thread::yield();
}
},
tbb::static_partitioner{});
#endif

const char* name = "test setup";
FrameMarkStart(name);

Expand Down

0 comments on commit f02edbb

Please sign in to comment.