Skip to content

Commit

Permalink
Add CPATH and LIBRARY_PATH to ucx building block (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
samcmill authored Jul 2, 2020
1 parent 8450f85 commit 785f9ed
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/building_blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4198,8 +4198,8 @@ configuring. For instance, `enable_foo=True` maps to
Underscores in the parameter name are converted to dashes.

- __environment__: Boolean flag to specify whether the environment
(`LD_LIBRARY_PATH` and `PATH`) should be modified to include
UCX. The default is True.
(`CPATH`, `LD_LIBRARY_PATH`, `LIBRARY_PATH`, and `PATH`) should be
modified to include UCX. The default is True.

- __gdrcopy__: Flag to control whether gdrcopy is used by the build. If
True, adds `--with-gdrcopy` to the list of `configure` options.
Expand Down
8 changes: 6 additions & 2 deletions hpccm/building_blocks/ucx.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class ucx(bb_base, hpccm.templates.downloader, hpccm.templates.envvars,
Underscores in the parameter name are converted to dashes.
environment: Boolean flag to specify whether the environment
(`LD_LIBRARY_PATH` and `PATH`) should be modified to include
UCX. The default is True.
(`CPATH`, `LD_LIBRARY_PATH`, `LIBRARY_PATH`, and `PATH`) should be
modified to include UCX. The default is True.
gdrcopy: Flag to control whether gdrcopy is used by the build. If
True, adds `--with-gdrcopy` to the list of `configure` options.
Expand Down Expand Up @@ -223,6 +223,10 @@ def __init__(self, **kwargs):
kwargs['url'] = self.url

# Setup the environment variables
self.environment_variables['CPATH'] = '{}:$CPATH'.format(
posixpath.join(self.__prefix, 'include'))
self.environment_variables['LIBRARY_PATH'] = '{}:$LIBRARY_PATH'.format(
posixpath.join(self.__prefix, 'lib'))
self.environment_variables['PATH'] = '{}:$PATH'.format(
posixpath.join(self.__prefix, 'bin'))
if not self.ldconfig:
Expand Down
40 changes: 30 additions & 10 deletions test/test_ucx.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def test_defaults_ubuntu(self):
make -j$(nproc) && \
make -j$(nproc) install && \
rm -rf /var/tmp/ucx-1.8.0 /var/tmp/ucx-1.8.0.tar.gz
ENV LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
ENV CPATH=/usr/local/ucx/include:$CPATH \
LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

@x86_64
Expand All @@ -77,7 +79,9 @@ def test_defaults_centos(self):
make -j$(nproc) && \
make -j$(nproc) install && \
rm -rf /var/tmp/ucx-1.8.0 /var/tmp/ucx-1.8.0.tar.gz
ENV LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
ENV CPATH=/usr/local/ucx/include:$CPATH \
LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

@x86_64
Expand All @@ -103,7 +107,9 @@ def test_with_paths_ubuntu(self):
make -j$(nproc) && \
make -j$(nproc) install && \
rm -rf /var/tmp/ucx-1.8.0 /var/tmp/ucx-1.8.0.tar.gz
ENV LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
ENV CPATH=/usr/local/ucx/include:$CPATH \
LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

@x86_64
Expand All @@ -128,7 +134,9 @@ def test_with_true_ubuntu(self):
make -j$(nproc) && \
make -j$(nproc) install && \
rm -rf /var/tmp/ucx-1.8.0 /var/tmp/ucx-1.8.0.tar.gz
ENV LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
ENV CPATH=/usr/local/ucx/include:$CPATH \
LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

@x86_64
Expand All @@ -153,7 +161,9 @@ def test_with_false_ubuntu(self):
make -j$(nproc) && \
make -j$(nproc) install && \
rm -rf /var/tmp/ucx-1.8.0 /var/tmp/ucx-1.8.0.tar.gz
ENV LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
ENV CPATH=/usr/local/ucx/include:$CPATH \
LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

@x86_64
Expand All @@ -179,7 +189,9 @@ def test_ldconfig(self):
make -j$(nproc) install && \
echo "/usr/local/ucx/lib" >> /etc/ld.so.conf.d/hpccm.conf && ldconfig && \
rm -rf /var/tmp/ucx-1.4.0 /var/tmp/ucx-1.4.0.tar.gz
ENV PATH=/usr/local/ucx/bin:$PATH''')
ENV CPATH=/usr/local/ucx/include:$CPATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

@x86_64
@ubuntu
Expand Down Expand Up @@ -225,7 +237,9 @@ def test_ppc64le(self):
make -j$(nproc) && \
make -j$(nproc) install && \
rm -rf /var/tmp/ucx-1.5.2 /var/tmp/ucx-1.5.2.tar.gz
ENV LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
ENV CPATH=/usr/local/ucx/include:$CPATH \
LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

@x86_64
Expand Down Expand Up @@ -255,7 +269,9 @@ def test_git_repository_true(self):
make -j$(nproc) && \
make -j$(nproc) install && \
rm -rf /var/tmp/ucx
ENV LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
ENV CPATH=/usr/local/ucx/include:$CPATH \
LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

@x86_64
Expand Down Expand Up @@ -286,7 +302,9 @@ def test_git_repository_value(self):
make -j$(nproc) && \
make -j$(nproc) install && \
rm -rf /var/tmp/ucx
ENV LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
ENV CPATH=/usr/local/ucx/include:$CPATH \
LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

@ubuntu
Expand All @@ -302,5 +320,7 @@ def test_runtime(self):
binutils && \
rm -rf /var/lib/apt/lists/*
COPY --from=0 /usr/local/ucx /usr/local/ucx
ENV LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
ENV CPATH=/usr/local/ucx/include:$CPATH \
LD_LIBRARY_PATH=/usr/local/ucx/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/ucx/lib:$LIBRARY_PATH \
PATH=/usr/local/ucx/bin:$PATH''')

0 comments on commit 785f9ed

Please sign in to comment.