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

Automatic download and build of MOAB #969

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

bam241
Copy link
Member

@bam241 bam241 commented Dec 4, 2024

Description

Add capability to automate pull and build MOAB at DAGMC building time

This is redondant with #964

Motivation and Context

This is part of the project from @shimwell on getting a pip install for OpenMC with DAGMC.

Changes

tweaked a little bit the findMOAB.cmake

  • add a make files that contains the proper ExternalProject configuration
  • add a CMAKE variable to enable pull and build and change the dips and link for the other DAGMC library

Behavior

Nothing changes if DDL_DEPS is not set at ON on Cmake configuration.
Otherwise pull build MOAB from MOAB repo builds it, and build the DAGMC lib against it.

Changelog file

  • Done

This is very much inspired by @ahnaf-tahmid-chowdhury work on PyNE cmake.

This works is sponsored by Proxima Fusion

@bam241
Copy link
Member Author

bam241 commented Dec 4, 2024

@ahnaf-tahmid-chowdhury @shimwell @gonuke even if this is still a draft, feel free to provide any feed back!

src/pyne/CMakeLists.txt Outdated Show resolved Hide resolved
src/dagmc/CMakeLists.txt Outdated Show resolved Hide resolved
Comment on lines 122 to 123
else()
# message(FATAL_ERROR "Could not find MOAB")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still return a fatal_error if ExternalProject encounters an issue

@bam241
Copy link
Member Author

bam241 commented Dec 4, 2024

The safeguard I added should be improve... (i.e.: have them only MOAB download is triggered...)

cmake/FindMOAB.cmake Outdated Show resolved Hide resolved
cmake/FindMOAB.cmake Outdated Show resolved Hide resolved
@bam241 bam241 marked this pull request as ready for review December 6, 2024 06:42
@bam241 bam241 requested a review from gonuke December 6, 2024 06:54
@bam241
Copy link
Member Author

bam241 commented Dec 6, 2024

@gonuke this still needs some polishing here and there, but I think this is ready for a first opinion.

@bam241 bam241 force-pushed the auto_moab branch 2 times, most recently from d49d208 to 45feb89 Compare December 6, 2024 11:32
Copy link
Member

@ahnaf-tahmid-chowdhury ahnaf-tahmid-chowdhury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the update. I have a few comments for improvement.

cmake/DAGMC_macros.cmake Outdated Show resolved Hide resolved
cmake/MOAB_PullAndMake.cmake Outdated Show resolved Hide resolved
-DBUILD_SHARED_LIBS:BOOL=ON
-DENABLE_HDF5:BOOL=ON
-DHDF5_ROOT:PATH=${HDF5_ROOT}
-DCMAKE_INSTALL_RPATH=${HDF5_ROOT}/lib:${MOAB_INSTALL_PREFIX}/lib

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method may work here for now, but may create trouble while working with scikit-build-core depended project. However, I am not sure here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no experience about scikit-build-core, maybe we shall fix it, if the problem occurs ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe MOAB master branch now has scikit-build core while version 5.5.1 does not.

Perhaps changing the moab version to master would provide a quick way of checking if this continues to work

      GIT_REPOSITORY https://bitbucket.org/fathomteam/moab.git
      GIT_TAG ${moab_version}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying it now.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to mention @bam241 tried this with the master branch of MOAB (which has scikit build core) and reported that it works

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have a doubt about what I did, I'll try one more time

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any final resolution on this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this against MOAB master, this works.

Test on 5fe643b
checked the proper work of this against MOAB Master branch

@@ -50,6 +50,9 @@ jobs:
5.4.1,
5.5.1,
]
ddl_deps : [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use of it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is like Enable Download MOAB or Double Down?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this only enables MOAB Download, otherwise everything work as it used to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion about the name of the variable,
but eventually one might want to include Embree and DD the same way...

if your question is about the addition into the matrix, I needed it to allow the CI to test for this kind of build...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to pass, I'll revert the change

@jon-proximafusion
Copy link

jon-proximafusion commented Dec 10, 2024

Testing locally with this docker file and it compiles for me
Note this points to Bam's fork and this PR branch
Also note, this example is very minimal with no DD, Embree, Pyne

FROM ubuntu:24.04

RUN apt-get update -y
RUN apt-get install git cmake libhdf5-serial-dev g++ libeigen3-dev -y 

RUN mkdir DAGMC && \
	cd DAGMC && \
	git clone --single-branch --branch auto_moab --depth 1 https://github.com/bam241/DAGMC.git && \
	mkdir build && \
	cd build && \
	cmake ../DAGMC -DBUILD_TALLY=ON \
                   -DBUILD_STATIC_EXE=OFF \
                   -DBUILD_STATIC_LIBS=OFF \
                   -DCMAKE_INSTALL_PREFIX=/DAGMC/ \
                   -DBUILD_UWUW=OFF \
                   -DDDL_INSTALL_DEPS=ON && \
	make -j install

@bam241
Copy link
Member Author

bam241 commented Dec 12, 2024

Test on 5fe643b
checked the proper work of this against MOAB Master branch

bam241 and others added 9 commits January 9, 2025 15:19
change location

cmake up

cmake up

cmake up

CMAKE_MODULE_PATH

CMAKE_MODULE_PATH

CMAKE_MODULE_PATH

adding LIBS

adding LIBS

install_dependent_library(MOAB )

install_dependent_library

adding LIBS

adding LIBS

adding LIBS

adding LIBS

adding LIBS

adding LIBS

adding LIBS

adding LIBS

instal_prefix

instal_prefix

instal_prefix

instal_prefix

instal_prefix

instal_prefix

instal_prefix

instal_prefix

instal_prefix

instal_prefix

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

INTERFACE

tmp

get the safeguard

revert unnecessary change
Co-authored-by: Jonathan Shimwell <[email protected]>
Co-authored-by: Jonathan Shimwell <[email protected]>
@jon-proximafusion
Copy link

IMO this PR makes building DAGMC easier for users. Currently we ask users to compile MOAB and then compile DAGMC passing some of the info on MOAB to the DAGMC compile. I believe the current situation is overly complicated.

This PR simplifies the compile for users which I think will be appreciated and lowers the bar slightly for installing DAGMC which might help bring in a few more users.

Screenshot From 2025-01-09 17-35-25

Additionally it retains backwards compatibility so if someone does what to compile both MOAB and DAGMC in the current way then they can still do that.

The main change I would suggest is that we make the pull_install_moab variable accept a version number of MOAB and default to the current latest. This would offer greater user control over the automated download. However that could be a follow up PR if desired.

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments trying to streamline and localize these changes.

CMakeLists.txt Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're including and running another macro here now, can we add a comment at the top of this that lists all the variables that expect to be set once this FindMOAB is complete? Then we can make sure the same/similar comment is at the top of that new macro.

if (MOAB_CMAKE_CONFIG)

# First check if we are forcing the download of MOAB
if (PULL_INSTALL_MOAB)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we thought about whether we put this condition up one level? That is, if we are going to PULL_INSTALL, then we don't call FindPackage at all and just do this macro instead? Then we don't need to mess with the FindMOAB file. I think that will work???

pshriwise
pshriwise previously approved these changes Jan 9, 2025
Copy link
Member

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm nominally on board here and want to make the installation process easier, but I do have concerns. There are secondary dependencies to consider and how we might specify those to the direct dependencies of MOAB. For example, there's a requirement here for an HDF5_ROOT that's expected to be set prior to the CMake call (from what I can tell).

I think what's here really would make the installation process better for all, but I do want to think through these scenarios thoroughly.

@@ -18,6 +18,11 @@ add_library(mcnp_funcs OBJECT mcnp_funcs.cpp)
message(STATUS "Building object library: meshtal_funcs")
add_library(meshtal_funcs OBJECT meshtal_funcs.cpp)

if(PULL_INSTALL_MOAB)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious as to why these lines are needed now when they weren't before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal is to allow if asked for, the possibility to pull and compile MOAB at the DAGMC build time

This variable has been added to detect if such auto download and compilation of MOAB is requested.

-DBUILD_SHARED_LIBS:BOOL=ON
-DENABLE_HDF5:BOOL=ON
-DHDF5_ROOT:PATH=${HDF5_ROOT}
-DCMAKE_INSTALL_RPATH=${HDF5_ROOT}/lib:${MOAB_INSTALL_PREFIX}/lib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any final resolution on this?

Copy link
Member

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, meant to comment not approve.. yet 😄

@bam241
Copy link
Member Author

bam241 commented Jan 9, 2025

💔

@makeclean
Copy link
Contributor

IMO you should also add -DENABLE_FORTRAN=OFF, -DENABLE_BLASLAPCK=OFF you might need to pass an EIGEN3_DIR or something

@bam241
Copy link
Member Author

bam241 commented Jan 10, 2025

@gonuke, I moved this 1 level.

I added a HDF5_macor.cmake file that factories HDF5 search and variables definition.

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

Successfully merging this pull request may close these issues.

7 participants