0

(N.B. I'm still confused about how asm.js works and what types of software it can "auto convert", and I'm also still confused about a lot of terminology along the stack of auto conversion from original source. Please be kind and make constructive comments, if you feel the need to downvote.)

How do you use asm.js to convert code that depends on a number of external libraries to run?

  • what do you apply emscripten to in such a complex dependency situation?

  • are there certain classes of c-based software where this just won't work?

For example - pix2pix

It seems that because pix2pix is based on Torch, which eventually uses llvm, this seems asm.js can convert it?

1 Answer 1

1

In a nutshell emscripten takes llvm code (which has been generated from C++ code, but theoretically could be any language supported by llvm) and converts it to javascript. You can read more about it in detail in its paper here

From this it should be clear that it needs the C++ source code to compile to js.

Now what about the C++ standard library? Emscripten has a port of some of the C++ library functions. You have fileSystem emulation (emulation because a browser does not allow fs access to js code. However in case of nodejs it works), implementation for containers, algorithm, etc. Support for threads is not available because it is a feature js does not support directly(specially in production browsers)

This should also make it clear that any platform dependent code will not work(unless you have that in source code form as well.).

For example pix2pix seems to be using NVIDIA CUDA library to be able to run on GPU. This is provided via platform specific drivers by NVIDIA, so it is not possible to convert it to emscripten. But if the core logic of this library can be made independent of platform code and every library it depends on is also available in source-code form, it should be possible to create asm.js port of pix2pix.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.