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

Files copied inside singularity not found (intel_psxe building block) #341

Closed
VI-gha opened this issue Feb 21, 2021 · 10 comments
Closed

Files copied inside singularity not found (intel_psxe building block) #341

VI-gha opened this issue Feb 21, 2021 · 10 comments

Comments

@VI-gha
Copy link

VI-gha commented Feb 21, 2021

The intel_psxe building block installs Intel Parallel Studio XE and requires a license file and a tarball:

base image

Stage0 += baseimage(image='ubuntu:{}'.format(18.04), _as='build')

Intel PSXE

#Stage0 += intel_psxe(eula=True, license='license.lic', tarball='parallel_studio_xe_2020_update4_cluster_edition.tgz')

When building a singularity container these files are apparently copied into a temporary folder (whose name changes every time):

INFO: Copying parallel_studio_xe_2020_update4_cluster_edition.tgz to /tmp/build-temp-795513904/rootfs/var/tmp/parallel_studio_xe_2020_update4_cluster_edition.tgz
INFO: Copying license.lic to /tmp/build-temp-795513904/rootfs/var/tmp/license.lic

which means that the build fails when they are not found:

  • tar -x -f /var/tmp/parallel_studio_xe_2020_update4_cluster_edition.tgz -C /var/tmp -z
    tar (child): /var/tmp/parallel_studio_xe_2020_update4_cluster_edition.tgz: Cannot open: No such file or directory

I tried to copy the files in other locations but they always end up in temporary folders and are never found during the build

Can you help me sort this out?

@samcmill
Copy link
Collaborator

What is your Singularity build command line?

@VI-gha
Copy link
Author

VI-gha commented Feb 21, 2021 via email

@VI-gha
Copy link
Author

VI-gha commented Feb 22, 2021

I have tried something similar with the AOCC compiler (which is much smaller) and get the same type of error
This reproduces it (I just kept the bare minimum)

BootStrap: docker
From: ubuntu:18.04

%files
aocc-compiler-2.3.0.tar /var/tmp

%post
tar -xvf /var/tmp/aocc-compiler-2.3.0.tar -C /usr/local
cd /usr/local/aocc-compiler-2.3.0
bash install.sh

What is fundamentally wrong with that?

@samcmill
Copy link
Collaborator

What version of Singularity and OS are you using? I can't reproduce the issue with 3.5.3 on Linux (CentOS 7).

It might be apptainer/singularity#5514? That only impacts 3.6 and later on WSL. The workaround in that case is to use a directory that is not bind mounted from the host into the container, so please try hpccm --working-directory /other/path ...

@VI-gha
Copy link
Author

VI-gha commented Feb 22, 2021 via email

@VI-gha
Copy link
Author

VI-gha commented Feb 22, 2021 via email

@samcmill
Copy link
Collaborator

The --working-directory option changes the location inside the container to use as the working (staging) directory.

For example, if the recipe is:

Stage0 += baseimage(image='ubuntu:18.04')

Stage0 += intel_psxe(eula=True, license='license.lic', tarball='parallel_studio_xe_2020_update4_cluster_edition.tgz')

Then hpccm --recipe 341.py --format singularity --working-directory /opt outputs:

BootStrap: docker
From: ubuntu:18.04
%post
    . /.singularity.d/env/10-docker*.sh

# Intel Parallel Studio XE
%post
    apt-get update -y
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        build-essential \
        cpio
    rm -rf /var/lib/apt/lists/*
%files
    parallel_studio_xe_2020_update4_cluster_edition.tgz /opt/parallel_studio_xe_2020_update4_cluster_edition.tgz
%files
    license.lic /opt/license.lic
%post
    cd /
    mkdir -p /opt && tar -x -f /opt/parallel_studio_xe_2020_update4_cluster_edition.tgz -C /opt -z
    sed -i -e 's/^#\?\(COMPONENTS\)=.*/\1=DEFAULTS/g' \
        -e 's|^#\?\(PSET_INSTALL_DIR\)=.*|\1=/opt/intel|g' \
        -e 's/^#\?\(ACCEPT_EULA\)=.*/\1=accept/g' \
        -e 's/^#\?\(ACTIVATION_TYPE\)=.*/\1=license_file/g' \
        -e 's|^#\?\(ACTIVATION_LICENSE_FILE\)=.*|\1=/opt/license.lic|g' /opt/parallel_studio_xe_2020_update4_cluster_edition/silent.cfg
    cd /opt/parallel_studio_xe_2020_update4_cluster_edition && ./install.sh --silent=silent.cfg
    rm -rf /opt/parallel_studio_xe_2020_update4_cluster_edition.tgz /opt/parallel_studio_xe_2020_update4_cluster_edition
%post
    cd /
    echo "source /opt/intel/compilers_and_libraries/linux/bin/compilervars.sh intel64" >> /etc/bash.bashrc

Note that the tarball is copied to /opt rather than /var/tmp.

This looks like a Singularity issue, not a HPCCM issue? Have you filed an issue at https://github.com/hpcng/singularity/issues?

@VI-gha
Copy link
Author

VI-gha commented Feb 23, 2021 via email

@VI-gha
Copy link
Author

VI-gha commented Feb 25, 2021

@samcmill

Thanks again Scott, it worked when using --working-directory /opt
I guess that others will have the same problem: would it not be better if that was documented or if the intel_psxe building block was modified to use %setup+cp instead of %files?

%setup
    cp parallel_studio_xe_2020_update4_cluster_edition.tgz /var/tmp/parallel_studio_xe_2020_update4_cluster_edition.tgz
    cp license.lic /var/tmp/license.lic

@samcmill
Copy link
Collaborator

Thanks @VI-gha. I need to investigate the apparent Singularity changed %files behavior. The solution may be to use %setup, I'm not sure.

I'm going to close this issue and open a new one focused on the Singularity behavior change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants