Skip to content

Commit b95cb0f

Browse files
Build and Run ARM Docker Containers on x86 arch
1 parent a8137d9 commit b95cb0f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Diff for: go/run_arm64_in_x86.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
### Setting Up ARM Emulation on x86
2+
3+
We’ll be using QEMU and Docker to set up our emulated environment. QEMU is an open source machine emulator and virtualizer. It allows users to to build ARM CUDA binaries on your x86 machine without needing a cross compiler.
4+
5+
First, let’s see what happens before setting up the emulation when trying to execute a program compiled for a different architecture :
6+
7+
```console
8+
$ uname -m # Display the host architecture
9+
x86_64
10+
11+
$ docker run --rm -t arm64v8/ubuntu uname -m # Run an executable made for aarch64 on x86_64
12+
standard_init_linux.go:211: exec user process caused "exec format error"
13+
```
14+
15+
As expected the instructions are not recognized since the packages are not installed yet. Installing the following packages should allow you to enable support for aarch64 containers on your x86 workstation:
16+
17+
#### 1. Install the qemu and required dependent packages
18+
19+
```console
20+
$ sudo apt-get install qemu binfmt-support qemu-user-static
21+
```
22+
23+
#### 2. Step to execute the registering scripts
24+
```console
25+
$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
26+
```
27+
28+
#### 3. Testing the emulation environment
29+
```console
30+
$ docker run --rm -t arm64v8/ubuntu uname -m
31+
aarch64
32+
```

0 commit comments

Comments
 (0)