Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-17423: [CI][C++] Fix building CUDA docker images #13896

Merged
merged 3 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ UBUNTU=20.04

# Default versions for various dependencies
CLANG_TOOLS=12
CUDA=9.1
CUDA=11.0.3
DASK=latest
DOTNET=6.0
GCC_VERSION=""
Expand Down
18 changes: 6 additions & 12 deletions dev/archery/archery/docker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
# under the License.

import os
import re
import shlex
import subprocess
from io import StringIO

from dotenv import dotenv_values
from ruamel.yaml import YAML

from ..utils.command import Command, default_bin
from ..utils.source import arrow_path
from ..compat import _ensure_path


Expand All @@ -42,12 +43,6 @@ def flatten(node, parents=None):
raise TypeError(node)


def _sanitize_command(cmd):
if isinstance(cmd, list):
cmd = " ".join(cmd)
return re.sub(r"\s+", " ", cmd)


_arch_short_mapping = {
'arm64v8': 'arm64',
}
Expand Down Expand Up @@ -294,7 +289,7 @@ def _build(service, use_cache):

args.extend([
'--output', 'type=docker',
'-f', service['build']['dockerfile'],
'-f', arrow_path(service['build']['dockerfile']),
'-t', service['image'],
service['build'].get('context', '.')
])
Expand All @@ -306,7 +301,7 @@ def _build(service, use_cache):
for img in cache_from:
args.append('--cache-from="{}"'.format(img))
args.extend([
'-f', service['build']['dockerfile'],
'-f', arrow_path(service['build']['dockerfile']),
'-t', service['image'],
service['build'].get('context', '.')
])
Expand Down Expand Up @@ -381,10 +376,9 @@ def run(self, service_name, command=None, *, env=None, volumes=None,
if command is not None:
args.append(command)
else:
# replace whitespaces from the preformatted compose command
cmd = _sanitize_command(service.get('command', ''))
cmd = service.get('command', '')
if cmd:
args.append(cmd)
args.extend(shlex.split(cmd))

# execute as a plain docker cli command
self._execute_docker('run', '--rm', *args)
Expand Down
2 changes: 1 addition & 1 deletion dev/archery/archery/docker/tests/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def test_image_with_gpu(arrow_compose_path):
"-e", "OTHER_ENV=2",
"-v", "/host:/container:rw",
"org/ubuntu-cuda",
'/bin/bash -c "echo 1 > /tmp/dummy && cat /tmp/dummy"'
"/bin/bash", "-c", "echo 1 > /tmp/dummy && cat /tmp/dummy",
]
]
with assert_docker_calls(compose, expected_calls):
Expand Down
4 changes: 2 additions & 2 deletions dev/archery/archery/integration/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
from .tester_java import JavaTester
from .tester_js import JSTester
from .tester_csharp import CSharpTester
from .util import (ARROW_ROOT_DEFAULT, guid, SKIP_ARROW, SKIP_FLIGHT,
printer)
from .util import guid, SKIP_ARROW, SKIP_FLIGHT, printer
from ..utils.source import ARROW_ROOT_DEFAULT
from . import datagen


Expand Down
3 changes: 2 additions & 1 deletion dev/archery/archery/integration/tester_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import subprocess

from .tester import Tester
from .util import run_cmd, ARROW_ROOT_DEFAULT, log
from .util import run_cmd, log
from ..utils.source import ARROW_ROOT_DEFAULT


_EXE_PATH = os.environ.get(
Expand Down
3 changes: 2 additions & 1 deletion dev/archery/archery/integration/tester_csharp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import os

from .tester import Tester
from .util import run_cmd, ARROW_ROOT_DEFAULT, log
from .util import run_cmd, log
from ..utils.source import ARROW_ROOT_DEFAULT


_EXE_PATH = os.path.join(
Expand Down
3 changes: 2 additions & 1 deletion dev/archery/archery/integration/tester_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import subprocess

from .tester import Tester
from .util import run_cmd, ARROW_ROOT_DEFAULT, log
from .util import run_cmd, log
from ..utils.source import ARROW_ROOT_DEFAULT


def load_version_from_pom():
Expand Down
4 changes: 3 additions & 1 deletion dev/archery/archery/integration/tester_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import os

from .tester import Tester
from .util import run_cmd, ARROW_ROOT_DEFAULT, log
from .util import run_cmd, log
from ..utils.source import ARROW_ROOT_DEFAULT


_EXE_PATH = os.path.join(ARROW_ROOT_DEFAULT, 'js/bin')
_VALIDATE = os.path.join(_EXE_PATH, 'integration.js')
Expand Down
3 changes: 2 additions & 1 deletion dev/archery/archery/integration/tester_rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import subprocess

from .tester import Tester
from .util import run_cmd, ARROW_ROOT_DEFAULT, log
from .util import run_cmd, log
from ..utils.source import ARROW_ROOT_DEFAULT


_EXE_PATH = os.path.join(ARROW_ROOT_DEFAULT, "rust/target/debug")
Expand Down
6 changes: 0 additions & 6 deletions dev/archery/archery/integration/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import contextlib
import io
import os
import random
import socket
import subprocess
Expand All @@ -36,11 +35,6 @@ def guid():
SKIP_ARROW = 'arrow'
SKIP_FLIGHT = 'flight'

ARROW_ROOT_DEFAULT = os.environ.get(
'ARROW_ROOT',
os.path.abspath(__file__).rsplit("/", 5)[0]
)


class _Printer:
"""
Expand Down
13 changes: 13 additions & 0 deletions dev/archery/archery/utils/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
from .git import git


ARROW_ROOT_DEFAULT = os.environ.get(
'ARROW_ROOT',
Path(__file__).resolve().parents[4]
)


def arrow_path(path):
"""
Return full path to a file given its path inside the Arrow repo.
"""
return os.path.join(ARROW_ROOT_DEFAULT, path)


class InvalidArrowSource(Exception):
pass

Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,14 @@ services:
ulimits: *ulimits
environment:
<<: *ccache
ARROW_BUILD_STATIC: "OFF"
ARROW_CUDA: "ON"
ARROW_GANDIVA: "OFF"
Copy link
Member

Choose a reason for hiding this comment

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

I assume this is to reduce build times and focus this on CUDA? 👍 Good idea!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

ARROW_GCS: "OFF"
ARROW_ORC: "OFF"
ARROW_S3: "OFF"
ARROW_SUBSTRAIT: "OFF"
ARROW_WITH_OPENTELEMETRY: "OFF"
volumes: *ubuntu-volumes
command: *cpp-command

Expand Down