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

kim-api installed from source on a Rocky (RHEL clone) 8 fails to add Ercolessi Adams model #88

Open
bernstei opened this issue Jun 14, 2023 · 5 comments

Comments

@bernstei
Copy link

Following the instructions at https://openkim.org/doc/usage/obtaining-models/#installing_api to install from source, with some slight modifications, appears to work. The modifications are to set -DCMAKE_INSTALL_PREFIX=${PWD}/../../installed-kim-api-2.3.0, as the LAMMPS kim README suggests, and to skip the sudos.

Using this installation to to install the Ercolessi-Adams model that the LAMMPS README refers to leads to an error. Our /tmp is mounted noexec, which I believe will also block shared libraries. Is there a way to set a different TMPDIR, in case that's the issue?

tin 1019 : kim-api-collections-management install user EAM_ErcolessiAdams_1994_Al__MO_324507536345_002
Downloading.............. EAM_ErcolessiAdams_1994_Al__MO_324507536345_002
[  9%] Generating kimspec.edn.c
[ 18%] Generating item-compiled-with-version.txt.c
[ 27%] Generating kimcite-MO_324507536345_002.bib.c
[ 36%] Generating kimprovenance.edn.c
Scanning dependencies of target EAM_ErcolessiAdams_1994_Al__MO_324507536345_002
[ 45%] Building Fortran object CMakeFiles/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002.dir/EAM_ErcolessiAdams_1994_Al.f90.o
[ 54%] Building C object CMakeFiles/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002.dir/item-compiled-with-version.txt.c.o
[ 63%] Building C object CMakeFiles/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002.dir/kimcite-MO_324507536345_002.bib.c.o
/tmp/kim-api-build-6GCR1fgKoR/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002/EAM_ErcolessiAdams_1994_Al.f90:1017:46:

 1017 |   requested_energy_unit, requested_charge_unit, requested_temperature_unit, &
      |                                              1
Warning: Unused dummy argument ‘requested_charge_unit’ at (1) [-Wunused-dummy-argument]
/tmp/kim-api-build-6GCR1fgKoR/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002/EAM_ErcolessiAdams_1994_Al.f90:1017:23:

 1017 |   requested_energy_unit, requested_charge_unit, requested_temperature_unit, &
      |                       1
Warning: Unused dummy argument ‘requested_energy_unit’ at (1) [-Wunused-dummy-argument]
/tmp/kim-api-build-6GCR1fgKoR/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002/EAM_ErcolessiAdams_1994_Al.f90:1016:70:

 1016 | recursive subroutine create(model_create_handle, requested_length_unit, &
      |                                                                      1
Warning: Unused dummy argument ‘requested_length_unit’ at (1) [-Wunused-dummy-argument]
/tmp/kim-api-build-6GCR1fgKoR/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002/EAM_ErcolessiAdams_1994_Al.f90:1017:74:

 1017 |   requested_energy_unit, requested_charge_unit, requested_temperature_unit, &
      |                                                                          1
Warning: Unused dummy argument ‘requested_temperature_unit’ at (1) [-Wunused-dummy-argument]
/tmp/kim-api-build-6GCR1fgKoR/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002/EAM_ErcolessiAdams_1994_Al.f90:1018:21:

 1018 |   requested_time_unit, ierr) bind(c)
      |                     1
Warning: Unused dummy argument ‘requested_time_unit’ at (1) [-Wunused-dummy-argument]
[ 72%] Building C object CMakeFiles/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002.dir/kimprovenance.edn.c.o
[ 81%] Building C object CMakeFiles/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002.dir/kimspec.edn.c.o
[ 90%] Building CXX object CMakeFiles/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002.dir/item-wrapper.cpp.o
[100%] Linking CXX shared module libkim-api-portable-model.so
[100%] Built target EAM_ErcolessiAdams_1994_Al__MO_324507536345_002
Running tests...
Test project /tmp/kim-api-build-6GCR1fgKoR/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002/build
    Start 1: shared_library_test_EAM_ErcolessiAdams_1994_Al__MO_324507536345_002
1/1 Test #1: shared_library_test_EAM_ErcolessiAdams_1994_Al__MO_324507536345_002 ...***Failed    0.00 sec
Unable to open shared library.
/tmp/kim-api-build-6GCR1fgKoR/EAM_ErcolessiAdams_1994_Al__MO_324507536345_002/build/libkim-api-portable-model.so: failed to map segment from shared object


0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.00 sec

The following tests FAILED:
          1 - shared_library_test_EAM_ErcolessiAdams_1994_Al__MO_324507536345_002 (Failed)
Errors while running CTest
make: *** [Makefile:71: test] Error 8

Aborting!
tin 1020 : 
@ellio167
Copy link
Member

The kim-api uses the c++ standard routine std::filesystem::temp_directory_path() (https://en.cppreference.com/w/cpp/filesystem/temp_directory_path). So this is, logically, not a kim-api issue but an issue with your system. I guess the fix will depend on your system's implementation of the c++ standard. Yes, I would guess that you can use TMPDIR to put your system into working order.

@bernstei
Copy link
Author

I don't think it's obvious that it's an issue with our system as such, because the directory is created. It's only a problem because of KIM's assumption that a directory created this way is an acceptable place to put a shared library to be dynamically loaded. I realize it's not the most common configuration, but it's not a crazy one.

Setting TMPDIR does fix the issue. I think at the very least it could use a note in the docs someplace.

@ellio167
Copy link
Member

Actually, looking deeper, there are other places in collections-management scripts that just use TMPDIR directly.

if test x"" = x"${TMPDIR}"; then TMPDIR="/tmp"; fi

And we have a std::filesystem drop-in replacement for older compilers

static const char* temp_vars[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR", nullptr};

that will use TMPDIR first and then check other env variables if it's not defined.

So, yes, I think setting TMPDIR is the best solution here.

@ellio167
Copy link
Member

Ah, OK now I understand more clearly: the system provides /tmp but doesn't allow (direct) execution of files created there. Yeah, that's an issue.

It seems that the C++ standard doesn't say anything about the permissions of the returned temp directory; POSIX doesn't require systems to provide TMPDIR.

So, yeah, it seems that the best that can be done is to document the expectations of the kim-api:

  • The TMPDIR variable is set to a location where temp directories/files can be created and executed.
  • The std::filesystem::temp_directory_path() routine returns a location where temp directories/files can be created and executed.

We'll leave this issue open as a reminder to implement this addition to the documentation.

@bernstei
Copy link
Author

Sounds good.

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

No branches or pull requests

2 participants