New cmake build system for kim-api

Hello,

I wanted to let you know that we have recently made great strides toward
replacing the kim-api build system with a cmake implementation. This has
significantly improved the robustness of the configure and build process. It
has also resolved some long standing troubles with compiling on osX systems! We
expect to officially switch to the cmake system in the next couple of weeks.

It would be great if you could give it a try and report any problems or suggestions back to this group!

The code is in the "cmake" branch of the kim-api github repo (github.com/openkim/kim-api). Here are the commands that should allow you to build, test, and install the kim-api and the example models/drivers. I'll assume you have a github account with valid ssh keys:

git clone git@github\.com:openkim/kim\-api\.git cd kim-api
git checkout \-\-track origin/cmake mkdir build
$ cd build

# the next command sets the compilers to be used and calls cmake.
# Here I use the gcc version 8 compilers on my mac that I installed
# with homebrew. If you are using linux, you can just drop the "-8"
# from each compiler name. I also set the install prefix to
# \{PWD\}/test\_install, but you can make this anything you like \# \( {HOME}/local might be a good choice ).

CC=gcc\-8 CXX=g\+\+\-8 FC=gfortran\-8 cmake \.\./ \-DCMAKE\_BUILD\_TYPE=Debug \-DCMAKE\_INSTALL\_PREFIX={PWD}/test_install -DKIM_API_BUILD_MODELS_AND_DRIVERS=ON
make \-j4 make test
$ make install

Now you can "activate the kim-api" (set the PATH and PKG_CONFIG_PATH
environment variables and load bash completions).

$ source ./test_install/bin/kim-api-v2-activate

and you are ready to go...

$ kim-api-v2-collections-management list

I hope this all works smoothly for you, but if not send me a note!

Cheers,

Ryan

Hi Ryan,

using the cmake build system I get the following error:

/home/daniel/workspace/kim-api/fortran/src/kim_model_refresh_f.f90:177:66:

     c_loc(modelWillNotRequestNeighborsOfNoncontributingParticles))
                                                                  1
Error: Missing actual argument for argument 'half_list_hints_ptr' at (1)
make[2]: *** [CMakeFiles/kim-api.dir/build.make:297: CMakeFiles/kim-api.dir/
fortran/src/kim_model_refresh_f.f90.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/kim-api.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

I use gcc 8.2 on Linux.

Best regards,
Daniel

using the cmake build system I get the following error:

/home/daniel/workspace/kim-api/fortran/src/kim_model_refresh_f.f90:177:66:

    c_loc(modelWillNotRequestNeighborsOfNoncontributingParticles))
                                                                 1
Error: Missing actual argument for argument 'half_list_hints_ptr' at (1)
make[2]: *** [CMakeFiles/kim-api.dir/build.make:297: CMakeFiles/kim-api.dir/
fortran/src/kim_model_refresh_f.f90.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/kim-api.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Hi Daniel,

You seem to have some old files being accessed somewhere/somehow.

We had to remove the "halfListHint" (and rename, for clarity, the "paddingNeighborHint") because we realized that there are cases where the two hints cannot be independent.

Regardless, your build seems to be mixing the latest code from the cmake branch and older code. Can you try a clean clone and build and let me know if you still have problems?

Thanks,

Ryan

Hi Ryan,

you are right. I just switched branches and probably had some
stale files from the old build process left. After cleaning up
the build succeeds as expected. Sorry for the noise.

Daniel

Dear Ryan,

This sounds good. Is it too much to hope that the "long standing troubles with compiling on osX systems” is the 64-bit issue? I don’t assume that switching to cmake can solve that, but maybe it adds a magic option to something... Since the Asap simulator is a Python module, it cannot be build in 32-bit mode, so I am preparing to work in a virtual machine during the workshop next week.

Best regards - and see you on Monday!

Jakob

Hi Jakob,

In fact it does! Cmake is smart, it seems. Apparently there is a correct set of compiler flags that avoids the problems we have had with compiling in 64 bit on macOS for years.... (wish I had known that long ago!)

Give it a try.

Ryan