Skip to content

Migrate riscv cross-compiles to docker container - #7004

Merged
babsingh merged 1 commit into
eclipse-omr:masterfrom
jdekonin:riscv-to-docker
May 29, 2023
Merged

Migrate riscv cross-compiles to docker container#7004
babsingh merged 1 commit into
eclipse-omr:masterfrom
jdekonin:riscv-to-docker

Conversation

@jdekonin

Copy link
Copy Markdown

A recent loss of the debian 10 system that was used for riscv compiles pushed me into moving this to a container. Due so memory consumption issues @janvrany has an open PR to address (#6912), the hosts currently require ~10gb ram. Once #6912 has been reviewed/changed/merged...the hosts for riscv cross-compiles can be reduced in ram requirement.

Also needs a dependent jiro change. eclipse-cbi/jiro#277

  • remove deb10-x64-1 as its dead
  • add label "compile:riscv64:cross" to ub20-x64-omr7 and ub20-x64-omr9
    ** docker container also has a requirement on cgroup.v2 configuration on the host

fyi @babsingh @janvrany @AdamBrousseau

@jdekonin

Copy link
Copy Markdown
Author

jenkins build riscv

@jdekonin

Copy link
Copy Markdown
Author

jenkins build riscv

@babsingh

Copy link
Copy Markdown
Contributor

https://ci.eclipse.org/omr/job/PullRequest-linux_riscv64_cross/1127/console

An error was seen in the riscv build:

16:47:58  CMake Error at cmake/modules/OmrDetectSystemInformation.cmake:66 (message):
16:47:58    '-NOTFOUND' is not a valid value for OMR_SEMAPHORE_IMPLEMENTATION

@jdekonin

Copy link
Copy Markdown
Author

jenkins build riscv

@jdekonin

Copy link
Copy Markdown
Author

The scripting requires specific parameters to use the correct dockerfile. I've since added the parameters to the nightly and pr builds for riscv and this pr trigger for riscv should work as expected.

Note that the first time the container is built on the machine it will be slower to build an image. A future improvement will be to create an image weekly, monthly or as needed with the nightly or pr builds performing a pull of this prebuilt image.

@jdekonin

Copy link
Copy Markdown
Author

I believe this is ready for review @babsingh.

@janvrany

Copy link
Copy Markdown
Contributor

Looking at the job runs, I believe the build is running in wrong container:

21:25:10  Running on ub20-x64-omr9
...
21:25:39  + docker build -t buildomr .
21:25:39  Sending build context to Docker daemon  4.096kB

21:25:40  Step 1/12 : FROM nvidia/cuda:9.0-devel-ubuntu16.04 AS cuda-dev
21:25:40   ---> 5e8c06b47e9f
21:25:40  Step 2/12 : FROM ubuntu:20.04 AS base
21:25:40   ---> 88bd68917189

We may need to tweak omrbuild.groovy to use correct one. Maybe something like this?

diff --git a/buildenv/jenkins/omrbuild.groovy b/buildenv/jenkins/omrbuild.groovy
index c0d0437fd..8c8b309de 100644
--- a/buildenv/jenkins/omrbuild.groovy
+++ b/buildenv/jenkins/omrbuild.groovy
@@ -29,7 +29,6 @@ scmVars = null
 customWorkspace = null
 
 dockerImage = null
-dockerImageName = (params.IMAGE_NAME) ? params.IMAGE_NAME : "buildomr"
 
 /**
  * Move the below parameters into SPECS while implementing a generic
@@ -44,7 +43,6 @@ pullId = params.ghprbPullId
 
 cgroupV1Specs = ["linux_x86"]
 cgroupV2Specs = ["linux_x86-64", "linux_ppc-64_le_gcc"]
-dockerSpecs = ["linux_x86", "linux_x86-64"]
 
 nodeLabels = []
 runInDocker = false
@@ -167,6 +165,7 @@ SPECS = [
         'environment' : [
             'PATH+CCACHE=/usr/lib/ccache/'
         ],
+        'dockerImageName' : 'riscv64',
         'ccache' : true,
         'buildSystem' : 'cmake',
         'builds' : [
@@ -188,6 +187,7 @@ SPECS = [
             'PATH+CCACHE=/usr/lib/ccache/',
             'GTEST_COLOR=0'
         ],
+        'dockerImageName' : 'buildomr',
         'ccache' : true,
         'buildSystem' : 'cmake',
         'builds' : [
@@ -209,6 +209,7 @@ SPECS = [
             'PATH+CCACHE=/usr/lib/ccache/',
             'GTEST_COLOR=0'
         ],
+        'dockerImageName' : 'buildomr',
         'ccache' : true,
         'buildSystem' : 'cmake',
         'builds' : [
@@ -411,6 +412,10 @@ def test() {
     }
 }
 
+def dockerImageName() {
+    return (params.IMAGE_NAME) ? params.IMAGE_NAME : SPECS[buildSpec].dockerImageName
+}
+
 def cleanDockerContainers() {
     stage("Docker Remove Containers") {
         println("Listing docker containers to attempt removal")
@@ -428,7 +433,7 @@ def cleanDockerContainers() {
 def buildDockerImage() {
     stage("Docker Build") {
         dir("buildenv/docker/${arch}/${os}") {
-            dockerImage = docker.build(dockerImageName)
+            dockerImage = docker.build(dockerImageName())
         }
     }
 }
@@ -605,7 +610,7 @@ timestamps {
     timeout(time: 8, unit: 'HOURS') {
         stage('Queue') {
             nodeLabels += SPECS[buildSpec].label
-            runInDocker = dockerSpecs.contains(buildSpec)
+            runInDocker = dockerImageName() != null;
 
             if (cgroupV1Specs.contains(buildSpec)) {
                 nodeLabels += "cgroup.v1"

@jdekonin

jdekonin commented May 25, 2023

Copy link
Copy Markdown
Author

The most recent PR job landed on ub20-x64-omr7 and uses riscv-crosscompile as the IMAGE_NAME value.
https://ci.eclipse.org/omr/job/PullRequest-linux_riscv64_cross/1128/consoleFull

But reviewing the previous PR launch, you are definitely correct. The changes you detail would be part of the future improvement I eluded too that would able to pull a prebuilt image.

@babsingh babsingh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleanDockerContainers only removes Docker containers. All Docker images will be named buildomr. We are using Ubuntu 20 x64 for two different buildspecs. If there is an existing Docker image created using a different Dockerfile, will the script create a new Docker image or update the old one?

Comment thread buildenv/docker/riscv64/debian11/Dockerfile Outdated
Comment thread buildenv/docker/riscv64/debian11/Dockerfile Outdated
@babsingh

Copy link
Copy Markdown
Contributor

@AdamBrousseau Can you also concurrently review these changes?

RUN groupadd -r jenkins \
&& useradd -rm -u 1000 -g jenkins jenkins \
&& mkdir -p /home/jenkins/.ssh \
&& echo "Host git.eclipse.org*\n\tStrictHostKeyChecking no\n" > /home/jenkins/.ssh/config \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have anything on git.eclipse.org used in these builds?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall, but likely a c&p from another dockerfile and just not enough clean up so I'll remove.

@jdekonin
jdekonin force-pushed the riscv-to-docker branch 2 times, most recently from 6e224c3 to 5fc5233 Compare May 26, 2023 19:21
@jdekonin

Copy link
Copy Markdown
Author

jenkins build riscv

@babsingh

babsingh commented May 26, 2023

Copy link
Copy Markdown
Contributor

re #7004 (review):

In omrbuild.groovy, cleanDockerContainers only removes Docker containers. All Docker images will be named buildomr. We are using Ubuntu 20 x64 for two different buildspecs. If there is an existing Docker image created using a different Dockerfile, will the script create a new Docker image or update the old one?

^^^ @jdekonin @AdamBrousseau If the above statement is true, then we will need a unique docker image name (buildomr_<SPEC_NAME>) for each buildspec. This solution will be the code change suggested by @janvrany in #7004 (comment).

@jdekonin

Copy link
Copy Markdown
Author

All docker images will be named buildomr unless the value is overridden with a supplied IMAGE_NAME. I added that to the jobs to uses riscv-crosscompile as the value so there wouldn't be a conflict with the other docker image in use.

If you want that code changes as part of this PR that fine and not future enhancement, thats fine I'll get there eventually.

@babsingh

Copy link
Copy Markdown
Contributor

added that to the jobs to use riscv-crosscompile

Then, these changes should work fine.

The code LGTM. @jdekonin Can you please squash the commits?

* Add recipe to create RISC-V 64 sysroot to Dockerfile so
the sysroot is created as part of docker image build. - authored by janvrany
** The only drawback of this solution is that it contains hardcoded
paths to RISC-V libfakeroot and libfakechroot packages, so whenever
a new version is uploaded to Debian ports repository and old one
is removed, the Dockefile has to be updated.
* Add jenkins build pipeline dependencies and container updates

Signed-off-by: Joe deKoning <joe_dekoning@ca.ibm.com>
@babsingh

Copy link
Copy Markdown
Contributor

@AdamBrousseau Do these changes look good to you?

@AdamBrousseau AdamBrousseau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lftm now. Thanks.

@babsingh

Copy link
Copy Markdown
Contributor

Final verification before merge:

jenkins build riscv

@babsingh
babsingh merged commit 721a391 into eclipse-omr:master May 29, 2023
Comment thread buildenv/jenkins/omrbuild.groovy
jdekonin pushed a commit to jdekonin/omr that referenced this pull request May 30, 2023
Signed-off-by: Joe deKoning <joe_dekoning@ca.ibm.com>
@jdekonin
jdekonin deleted the riscv-to-docker branch May 30, 2023 14:23
babsingh added a commit that referenced this pull request May 30, 2023
Revert copyright change performed in #7004
rmnattas pushed a commit to rmnattas/omr that referenced this pull request Nov 7, 2023
Signed-off-by: Joe deKoning <joe_dekoning@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants