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

Kokkos library names in Kokkos and Trilinos #1902

Closed
kddevin opened this issue Nov 14, 2018 · 11 comments
Closed

Kokkos library names in Kokkos and Trilinos #1902

kddevin opened this issue Nov 14, 2018 · 11 comments
Assignees
Labels
Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos)

Comments

@kddevin
Copy link

kddevin commented Nov 14, 2018

Just curious:

Why does Kokkos use different library names if I build it in Trilinos vs building it in Kokkos?

When I build Kokkos directly, I get libkokkos.a.
When I build Kokkos as part of Trilinos, I get
libkokkosalgorithms.a libkokkoscore.a libkokkostsqr.a
libkokkoscontainers.a libkokkoskernels.a

This feature makes it difficult to interchange stand-alone Kokkos and Kokkos-in-Trilinos to build an external application. If this is Trilinos' problem, let me know; I'll take the question there.

Thanks.

@mhoemmen
Copy link
Contributor

Does "build Kokkos directly" mean "use Kokkos' Makefile-based build system"?

@kddevin
Copy link
Author

kddevin commented Nov 15, 2018

Yes.
${KOKKOS}/generate_makefile.bash
--kokkos-path=${KOKKOS}
--prefix=${INSTALL}
--with-serial

@mhoemmen
Copy link
Contributor

This feature makes it difficult to interchange stand-alone Kokkos and Kokkos-in-Trilinos to build an external application.

Trilinos does not promise a standard set of libraries. Users are supposed to draw the ordered list of libraries from the ${PACKAGE}_LIBRARIES variable, defined in each of the following two installed files:

  • Makefile.export.${PACKAGE} file (for a Makefile-based build system)
  • lib/cmake/${PACKAGE}/${PACKAGE}Config.cmake (for a CMake-based build system)

I don't think a TriBITS library can cross package boundaries. Changing Kokkos from a collection of subpackages into a single package would break backwards compatibility. It is possible, however, to combine several static libraries into one.

@crtrott
Copy link
Member

crtrott commented Nov 19, 2018

In the spirit of what Mark asked, do you actually hard-code your library list? We don't actually guarantee a specific name. What is guaranteed are the GNU and CMake variable names you are supposed to use. Also there is an option for the pure CMake build to build separate libraries instead of one. But I am not sure that we ever test that.

@crtrott
Copy link
Member

crtrott commented Nov 19, 2018

And as Mark said: we main issue on the Trilinos side is that you kinda have to split libraries by sub package, and we made sub packages since we wanted to give people the option not to link in or use algorithms and containers. While this isn't a super big deal for any people I know off, it has the added advantage of keeping our internal dependencies honest.

@kddevin
Copy link
Author

kddevin commented Nov 19, 2018

The library list is hard-coded for me in the application. I am building a tool (Genten) that is build on Kokkos. It can be built with Kokkos snapshotted into its source directory, or with an already installed Kokkos.

My first attempt tried to use the Kokkos in Trilinos, which is where I discovered the difference in library names. My intent was to ensure I was using the same version of Kokkos for comparisons between genten and a Trilinos-based tensor code. I gave up and snapshotted Kokkos.

Even if I remove Genten's hardcoded libkokkos.a, there are more inconsistencies that would prevent Genten from using Trilinos' build easily:

  • Makefile.export.Kokkos in Trilinos/BUILD/packages/kokkos defines variable Kokkos_LIBRARIES and includes the subpackages libraries (-lkokkoscore, etc.); it claims KOKKOS_LIBS is deprecated.
  • Makefile.kokkos created in Trilinos/BUILD defines KOKKOS_LIB as -lkokkos -ldl; it does not have the subpackage libraries.
  • Makefile.kokkos in the Kokkos distribution defines KOKKOS_LIBS with -lkokkos.

So an application like genten can't really use the kokkos in Trilinos without major hacking of some of these files. Maybe fixing Trilinos' generated Makefile.kokkos would work? I don't know the purpose of these different files in Trilinos.

@crtrott
Copy link
Member

crtrott commented Nov 22, 2018

Yeah. This is a bug in the generated Makefile.kokkos inside of Trilinos.

@crtrott crtrott added the Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos) label Nov 22, 2018
@crtrott
Copy link
Member

crtrott commented Nov 22, 2018

A Makefile.kokkos installed by Trilinos (or cmake) needs to contain the right KOKKOS_LIBS arguments, depending on whether the sub packages were build separately.

@ndellingwood ndellingwood added this to the 2019 April milestone Feb 7, 2019
@jjwilke
Copy link

jjwilke commented Apr 15, 2019

This speaks to ... unnecessary... challenges with Trilinos. Kokkos really needs to be spun off as a TPL. Generally speaking, everything in Trilinos at the very least should be supported as either an internal package or a TPL.

I should be able to hack this for now by having Kokkos always install a kokkosConfig.make - EVEN when installed with Trilinos. For non-Tribits things using Kokkos as a TPL, this will provide a function:

FIND_PACKAGE(kokkos)
....
TARGET_LINK_KOKKOS(myTarget)

The details of the exact list of libraries and names will not be necessary.

@jjwilke jjwilke self-assigned this Apr 15, 2019
@crtrott crtrott removed this from the 2019 April milestone Aug 21, 2019
crtrott added a commit that referenced this issue Aug 27, 2019
@vqd8a vqd8a removed their assignment Sep 4, 2019
@jjwilke jjwilke added this to the 3.0 Release milestone Sep 4, 2019
@masterleinad masterleinad added this to To do in Milestone: Release 3.0 via automation Oct 3, 2019
@dalg24
Copy link
Member

dalg24 commented Oct 7, 2019

Related to #2295 and #2119

This was referenced Oct 9, 2019
@masterleinad
Copy link
Contributor

Addressed in #2447.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos)
Projects
No open projects
Development

No branches or pull requests

8 participants