University-of-Delaware-IT-RCI / auto_tmpdir

Slurm SPANK plugin for automated handling of temporary directories for jobs.
BSD 2-Clause "Simplified" License
4 stars 4 forks source link

CMake error: SLURM extensions directory could not be found #5

Closed OleHolmNielsen closed 2 years ago

OleHolmNielsen commented 2 years ago

We have slurm 21.08.8-2 installed as RPM packages. The OS is AlmaLinux 8.6. I installed the distributon's cmake RPM package.

Following the build instructions in README.md I'm trying to make a build but get an error about something called SLURM extensions directory:

[ohni@testlogin build-20220627]$ cmake -DSLURM_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release  -DAUTO_TMPDIR_ENABLE_SHARED_TMPDIR=YES     -DAUTO_TMPDIR_DEFAULT_SHARED_PREFIX=/scratch ..
CMake Deprecation Warning at CMakeLists.txt:1 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Error at CMakeLists.txt:27 (MESSAGE):
  SLURM extensions directory could not be found

-- Configuring incomplete, errors occurred!
See also "/home/niflheim/ohni/auto_tmpdir/build-20220627/CMakeFiles/CMakeOutput.log".

I wonder what's missing?

jtfrey commented 2 years ago

CMake Error at CMakeLists.txt:27 (MESSAGE): SLURM extensions directory could not be found

It's not finding the slurm plugins directory (where it needs to install the finished auto_tmpdir.so binary). The existing check looked for lib/slurm under the SLURM_PREFIX, since that's the standard hierarchy produced by ./configure for Slurm. I'll bet on your system it was configured explicitly to lib64/slurm, thus that path couldn't be found.

I've retooled the CMakeLists.txt to find slurm/task_none.so under the directory containing the located libslurm.so. It'll use the parent directory of that plugin as the installation target for auto_tmpdir.so. That should be a bit more portable. The changes are present on the master branch.

OleHolmNielsen commented 2 years ago

Thanks a lot, the cmake command now completes without errors:

[ohni@testlogin build-20220627]$ cmake -DSLURM_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release  -DAUTO_TMPDIR_ENABLE_SHARED_TMPDIR=YES     -DAUTO_TMPDIR_DEFAULT_SHARED_PREFIX=/scratch ..
-- SLURM Modules directory: /usr/lib64/slurm
-- Configuring done
-- Generating done
-- Build files have been written to: /home/niflheim/ohni/auto_tmpdir/build-20220627

The build also completes, albeit with a warning:

[ohni@testlogin build-20220627]$ make
[ 33%] Building C object CMakeFiles/auto_tmpdir.dir/fs-utils.c.o
/home/niflheim/ohni/auto_tmpdir/fs-utils.c: In function ‘auto_tmpdir_fs_bindpoint_dealloc’:
/home/niflheim/ohni/auto_tmpdir/fs-utils.c:90:21: warning: implicit declaration of function ‘slurm_warning’; did you mean ‘slurm_ping’? [-Wimplicit-function-declaration]
                     slurm_warning("auto_tmpdir::auto_tmpdir_fs_bindpoint_dealloc: unable to unmount bind point `%s` -> `%s`", bindpoint->to_this_path, bindpoint->bind_this_path);
                     ^~~~~~~~~~~~~
                     slurm_ping
[ 66%] Building C object CMakeFiles/auto_tmpdir.dir/auto_tmpdir.c.o
[100%] Linking C shared module auto_tmpdir.so
[100%] Built target auto_tmpdir

Installation as a non-root user is not permitted, however:

[ohni@testlogin build-20220627]$ make install
Consolidate compiler generated dependencies of target auto_tmpdir
[100%] Built target auto_tmpdir
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/lib64/slurm/auto_tmpdir.so
CMake Error at cmake_install.cmake:60 (file):
  file INSTALL cannot copy file
  "/home/niflheim/ohni/auto_tmpdir/build-20220627/auto_tmpdir.so" to
  "/usr/lib64/slurm/auto_tmpdir.so": Permission denied.

IMHO, the best solution would be if CMake would be able to generate an RPM package for installation by root on all cluster nodes, since we install Slurm as RPMs. The CPack RPM Generator from https://cmake.org/cmake/help/latest/cpack_gen/rpm.html seems to be a possibility. Do you think this is feasible?

jtfrey commented 2 years ago

It's understandable and predictable that you'd have to install as root if you're using binary packages. A sudo make install would work.

If you want an RPM package, maybe you could fork this project and make the necessary changes to CMakeLists.txt (get more familiar with CMake in the process) then open a pull request?

jtfrey commented 2 years ago

Re: the warning about slurm_warning(), that is indeed not a function defined by Slurm SPANK and needed to be replaced by calls to slurm_info(). Fix is present on the master branch.

OleHolmNielsen commented 2 years ago

Thanks for the fixes. Now the build works without any warnings:

[ohni@testlogin build-20220629]$ cmake -DSLURM_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release  -DAUTO_TMPDIR_ENABLE_SHARED_TMPDIR=YES     -DAUTO_TMPDIR_DEFAULT_SHARED_PREFIX=/scratch ..
-- The C compiler identification is GNU 8.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found SLURM: /usr/lib64/libslurm.so  
-- SLURM Modules directory: /usr/lib64/slurm
-- Configuring done
-- Generating done
-- Build files have been written to: /home/niflheim/ohni/auto_tmpdir/build-20220629
[ohni@testlogin build-20220629]$ make
[ 33%] Building C object CMakeFiles/auto_tmpdir.dir/fs-utils.c.o
[ 66%] Building C object CMakeFiles/auto_tmpdir.dir/auto_tmpdir.c.o
[100%] Linking C shared module auto_tmpdir.so
[100%] Built target auto_tmpdir
OleHolmNielsen commented 2 years ago

Regarding creating an RPM package for auto_tmpdir, I have no experience with CMake nor CPack, so I expect it would take me a long time to get this to work :-( Our cluster uses Rsync from a master server to distribute files, so the /usr/lib64/auto_tmpdir.so could be copied using that system. On RPM-based systems, in principle files in /usr/lib64 preferably ought to be installed with RPMs.

OleHolmNielsen commented 2 years ago

Just FYI: I've added my steps for installing auto_tmpdir to my Slurm Wiki page https://wiki.fysik.dtu.dk/niflheim/Slurm_configuration#temporary-job-directories.

jtfrey commented 2 years ago

Thanks!

jtfrey commented 2 years ago

@OleHolmNielsen Please see Issue #10 for a crack at enabling RPM package generation.