GithubHelp home page GithubHelp logo

Emscripten - Clang about poolstl HOT 5 CLOSED

alugowski avatar alugowski commented on July 20, 2024
Emscripten - Clang

from poolstl.

Comments (5)

afraidofdark avatar afraidofdark commented on July 20, 2024

It appears that I forgotto add -pthreads.
It works just fine after I have added
"-pthreads" and emscripten spesific "-sPTHREAD_POOL_SIZE=4"

from poolstl.

alugowski avatar alugowski commented on July 20, 2024

Yes, clang requires -pthread (though Apple Clang does not).

@afraidofdark do you know of a good way to test with emscripten in GitHub Actions?

from poolstl.

afraidofdark avatar afraidofdark commented on July 20, 2024

Yes, clang requires -pthread (though Apple Clang does not).

@afraidofdark do you know of a good way to test with emscripten in GitHub Actions?

A quick internet search brought up ready make actions that loads the emscripten, so compiling should be pretty easy but I am not sure if you can run tests without having explicit access to build server. I have used self-hosted runner, which run actions on my local machine so I can be sure that emscripten can popup a browser to run tests.

Self Hosted Runners ( Run actions on your machine so you can be sure test environment contains everything )
https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners

I have seen this guy running tests on .net ?
https://github.com/paulirwin/WasmNet/actions/runs/6647491182/job/18062967664

If I spot anything I'll be back here, or a seperate ticket can be created for testing emscripten.

from poolstl.

alugowski avatar alugowski commented on July 20, 2024

So it requires some fiddling, but it should be doable.

Just curious, are you experiencing any issues using poolSTL on Emscripten? Is performance as expected?

from poolstl.

alugowski avatar alugowski commented on July 20, 2024

I've added CI tests of Emscripten in #33

Basic setup appears to be pretty easy. Emscripten provides a toolchain file that makes CMake do all the right things. It even configures the tests properly, so ctest will run out of the box via node. Any plain executables can be run with node <target_name>. Node v21 handles everything out of the box, older versions might require some experimental switches for pthreads to work.

Like you say, -pthread switch is required for both compiling and linking. I've updated the poolSTL CMakeLists.txt to do this, and updated installation instructions to point it out. Note it's not -lpthread like is required by regular Clang.

At least on node, "-sPTHREAD_POOL_SIZE=4" appears to have no effect. Speedup is identical (and good) with and without. Though the Emscripten docs suggest -sPTHREAD_POOL_SIZE=navigator.hardwareConcurrency.

Benchmarks on my laptop show the expected speedups. On the CI hosts some methods act as expected, some (like sort) shows massive speedup, and some show a slowdown. CI hosts are pretty limited, though, and I see forum threads about tuning emscripten threading, so it might be worth benchmarking your particular application to make sure you're seeing the speedup you expect.

from poolstl.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.