-
Notifications
You must be signed in to change notification settings - Fork 256
Development Environment
SIMDe includes a Dockerfile which can be used to create a container for development. It is basically Debian with lots of cross-compilation tools, emulators, etc. installed, and an easy way to build SIMDe using a large number of different configurations.
For details, see the Docker README.
Being able to run native instructions is important during SIMDe development, especially to generate test vectors, but getting access to an enviroment to do that can be a bit painful. What follows is basic information options for various architectures.
I'm going to assume you're running Linux, but macOS will probably be okay (you'll likely need to use Homebrew). For Windows, you might be okay depending on what you're trying target.
Please consider submitting edits to this document if you have anything to add, such as hints for other operating systems, architectures, etc.
I'm going to assume you're developing on x86 / x86_64, because almost everyone is. So, this assumes that your development machine doesn't support the ISA extension you're working on. For example, if your machine doesn't do AVX-512.
The best thing to do is to use the Intel Software Development Emulator. You just have to explicity target the instruction set you're interested in when you compile, then run it in the SDE.
Once you've downloaded and extracted the SDE, the process looks like:
mkdir test/build && cd test/build
cmake .. -DCMAKE_{C,CXX}_FLAGS='-mavx512bw'
make -j
/path/to/sde/sd64 -- ./run-tests
Performance is obviously not as good as native, but it's definitely fast enough for SIMDe development.
WASM SIMD is a very new development, and isn't really stable anywhere yet, so you'll need to be using very recent software.
To compile, you'll need to use emscripten. See their installation documentation for instruction on installation; the version that ships with your Linux distribution probably isn't new enough: you should be using at least 1.39.10.
You'll also need to install d8 (a CLI for the V8 JavaScript engine), since the version of v8 that currently ships in Node.js is missing some crucial fixes. I suggest using jsvu to install it.
Installation instructions for jsvu are in their README.md. After
installing jsvu, you can install d8 with jsvu --engines=v8
.
After you source emsdk_env.sh, you can compile and test with something like:
mkdir test/build && cd test/build
emcmake cmake .. -DCMAKE_{C,CXX}_FLAGS="-msimd128 -O3"
make -j
~/.jsvu/v8 --experimental-wasm-simd run-tests.js
If you have a Raspberry Pi or something sitting around, that's probably the easiest way to go. You can install all the tools and just use them natively. Compilation can be a bit slow, but it's quite usable. Just remember that Raspbian runs in armv7 mode, so if you want to use AArch64, or even just ARMv8, you'll want to use something else. Fedora has good instructions, or there is a good chance that your distro of choice is also available.
I (Evan) have a Raspberry Pi 3 on which I do SIMDe development sometimes, I can probably arrange remote access for developing SIMDe. That said, the Raspberry Pi 4 should be significantly better, especially the models with extra RAM.
I (Christopher Moore aka rosbif) use cheap ($30 to $50) Chinese TV boxes. I recommend one with a Rockchip RK3328 or an Amlogic S905X2 or X3 processor. They are quad-core AArch64 processors with USB 3.0 and you can find ones with 4GB RAM and Gigabit Ethernet. The RK3399* and S922* processors are more powerful but the boxes are significantly more expensive. The Armbian Debian and Ubuntu distributions by balbes150 work well and now use mainline Linux kernels. For boxes not directly supported by these distributions you may have a little work writing a correct DTS. However most functions are native to the processor, hence common, but Wi-Fi can be a problem as there are many different chips. I have an X96 Max (S905X2 with 4GB RAM) running Debian testing which is accessible via Internet. If you are interested in a remote login please email me with your ssh public key. For my email address, grep my name in the header files. N.B. This system uses an experimental distribution and is supplied on a best effort basis with absolutely no guarantee. There are no backups so please save your work locally.
If you need something a bit faster, Debian offers excellent support for cross-compiling and running (using QEMU) ARM executables. I (Evan) use Fedora, but keep a Debian VM around largely for this reason. If you use Debian (or probably a derivative such as Ubuntu) you can skip the VM. To get it set up:
- Install the cross compiler(s) you're interested in. To use the current default versions of GCC for ARM and ARM64,
sudo apt-get install g{cc,++}-arm-linux-gnueabihf g{cc,++}-aarch64-linux-gnu
. You can also specify specific versions by installing, for example,gcc-10-arm-linux-gnueabihf
instead ofgcc-arm-linux-gnueabihf
. - Follow the instructions on the Debian wiki for Multiarch.
- To be able to run the code you compile, enable QEMU User Emulation.
Once all that is done, just set CC/CXX to the relevant compiler when configuring. For example, CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ meson ..
and everything should just work.
Alternatively, you can use one of the cross-files checked into docker/cross-files
. For example:
meson setup builddir --cross-file docker/cross-files/aarch64-gcc-10.cross
meson test -C builddir
Note that you can also use this technique for other architectures.
We have Travis CI builds for armv7, armv8, and aarch64. If you just need to check something you can just submit a PR, but please don't over-use this method. It's slow and eats up a lot of Travis' resources, which they are providing for free.
There are several places that offer free access to PPC environments for developing open source applications:
Note that you'll probably need to already be an active contributor to SIMDe to get an account, or at least have some sort of official connection (like being a GSoC student).
Barring that, you can use QEMU. It's painfully slow, but it does work. IIRC Alpine's instructions seem pretty easy to follow, or there is a blog post about Ubuntu guests.
QEMU. Sorry, it's going to be pretty slow. I strongly recommend cross-compiling, not attempting to compile natively. For the VM, IIRC last time I did this I used this blog post as a guide.