diff --git a/scripts/shared-macmini/build-and-test.sh b/scripts/shared-macmini/build-and-test.sh new file mode 100755 index 000000000..e0efbd532 --- /dev/null +++ b/scripts/shared-macmini/build-and-test.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Build and test Serac on team's shared MacMini, then report results to a set of emails + +# Update environment +source ~/.bash_profile + +# Variables +CI_ROOT_DIR="/Users/chapman39/dev/serac/ci" +PROJECT_DIR="$CI_ROOT_DIR/repo" +OUTPUT_LOG="$CI_ROOT_DIR/logs/macmini-build-and-test-$(date +"%Y_%m_%d_%H_%M_%S").log" +HOST_CONFIG="$CI_ROOT_DIR/host-configs/firion-darwin-sonoma-aarch64-clang@14.0.6.cmake" +RECIPIENTS="chapman39@llnl.gov,white238@llnl.gov,talamini1@llnl.gov" + +# Go to project directory +cd $PROJECT_DIR + +# Update Serac +git checkout task/chapman39/macmini-build >> $OUTPUT_LOG 2>&1 # TODO CHANGE TO DEVELOP +git pull >> $OUTPUT_LOG 2>&1 +git submodule update --init --recursive >> $OUTPUT_LOG 2>&1 + +# Clear previous build(s) +rm -rfv _serac_build_and_test* >> $OUTPUT_LOG 2>&1 + +# Build and test Serac +python3 ./scripts/llnl/build_src.py --host-config $HOST_CONFIG -v -j16 >> $OUTPUT_LOG 2>&1 + +# Email variables +if [ $? -eq 0 ]; then + EMAIL_SUBJECT="Serac Succeeded!" +else + EMAIL_SUBJECT="Serac Failed!" +fi +EMAIL_SUBJECT="$EMAIL_SUBJECT MacMini build and test report $(date)" +EMAIL_BODY="This is automatic weekly report of Serac's MacMini build. See attached for log." + +# Send report via email +echo "$EMAIL_BODY" | mutt -a "$OUTPUT_LOG" -s "$EMAIL_SUBJECT" -- "$RECIPIENTS" diff --git a/scripts/spack/configs/macos_sonoma_aarch64/spack.yaml b/scripts/spack/configs/macos_sonoma_aarch64/spack.yaml index 93054b73c..a43938b95 100644 --- a/scripts/spack/configs/macos_sonoma_aarch64/spack.yaml +++ b/scripts/spack/configs/macos_sonoma_aarch64/spack.yaml @@ -1,16 +1,32 @@ - spack: - # add package specs to the `specs` list - view: true - concretizer: - unify: true + view: false + + compilers:: + - compiler: + spec: clang@=14.0.6 + paths: + cc: /opt/homebrew/opt/llvm@14/bin/clang + cxx: /opt/homebrew/opt/llvm@14/bin/clang++ + f77: /opt/homebrew/bin/gfortran-14 + fc: /opt/homebrew/bin/gfortran-14 + flags: {} + operating_system: sonoma + target: aarch64 + modules: [] + environment: {} + extra_rpaths: + - /opt/homebrew/lib/gcc/14 + packages: all: compiler: [clang, gcc] providers: - blas: [netlib-lapack] + blas: [openblas] lapack: [netlib-lapack] mpi: [openmpi] + zlib-api: [zlib] + + # Providers mpi: buildable: false openmpi: @@ -18,20 +34,27 @@ spack: externals: - spec: openmpi@5.0.3_1 prefix: /opt/homebrew + openblas: + buildable: false + externals: + - spec: openblas@0.3.28 + prefix: /opt/homebrew netlib-lapack: buildable: false externals: - spec: netlib-lapack@3.12.0 prefix: /opt/homebrew/opt/lapack - autoconf: + zlib-ng: buildable: false externals: - - spec: autoconf@2.72 + - spec: zlib-ng@1.3.1 prefix: /opt/homebrew + + # External packages from Homebrew automake: buildable: false externals: - - spec: automake@1.16.5 + - spec: automake@1.17 prefix: /opt/homebrew bzip2: buildable: false @@ -39,91 +62,160 @@ spack: - spec: bzip2@1.0.8 prefix: /opt/homebrew/opt/bzip2 cmake: - version: [3.29.6] + version: [3.30.4] + buildable: false + externals: + - spec: cmake@3.30.4 + prefix: /opt/homebrew + diffutils: + buildable: false + externals: + - spec: diffutils@3.10 + prefix: /opt/homebrew + expat: + buildable: false + externals: + - spec: expat@2.6.3 + prefix: /opt/homebrew + fmt: buildable: false externals: - - spec: cmake@3.29.5 + - spec: fmt@11.0.2 prefix: /opt/homebrew gettext: buildable: false externals: - spec: gettext@0.22.5 prefix: /opt/homebrew + gnuconfig: + buildable: false + externals: + - spec: gnuconfig@2.72 + prefix: /opt/homebrew graphviz: buildable: false externals: - - spec: graphviz@11.0.0 + - spec: graphviz@12.1.12 prefix: /opt/homebrew libtool: buildable: false externals: - - spec: libtool@2.4.7 + - spec: libtool@2.5.3 prefix: /opt/homebrew libx11: buildable: false externals: - - spec: libx11@1.8.9 + - spec: libx11@1.8.10 prefix: /opt/homebrew - llvm: - version: [18.1.8] + lua: buildable: false externals: - - spec: llvm+clang@18.1.8 - prefix: /opt/homebrew/opt/llvm + - spec: lua@5.4.7 + prefix: /opt/homebrew m4: buildable: false externals: - spec: m4@1.4.19 prefix: /opt/homebrew/opt/m4 - perl: + ninja: buildable: false externals: - - spec: perl@5.34.1~cpanm+opcode+open+shared+threads - prefix: /usr + - spec: ninja@1.12.1 + prefix: /opt/homebrew + openssh: + buildable: false + externals: + - spec: openssh@3.3.6 + prefix: /opt/homebrew pkg-config: buildable: false externals: - spec: pkg-config@0.29.2_3 prefix: /opt/homebrew + pkgconf: + buildable: false + externals: + - spec: pkgconf@0.29.2_3 + prefix: /opt/homebrew + readline: + buildable: false + externals: + - spec: readline@8.2.13 + prefix: /opt/homebrew + sqlite: + buildable: false + externals: + - spec: sqlite@3.46.1 + prefix: /opt/homebrew + xz: + buildable: false + externals: + - spec: xz@5.6.3 + prefix: /opt/homebrew + + # External packages in /usr + curl: + buildable: false + externals: + - spec: curl@8.7.1 + prefix: /usr + git: + buildable: false + externals: + - spec: git@2.39.3 + prefix: /usr + gmake: + buildable: false + externals: + - spec: gmake@3.8.1 + prefix: /usr + perl: + buildable: false + externals: + - spec: perl@5.34.1~cpanm+opcode+open+shared+threads + prefix: /usr python: buildable: false externals: - - spec: python@3.12.4+bz2+crypt+ctypes+dbm+lzma+nis+pyexpat~pythoncmd+readline+sqlite3+ssl~tkinter+uuid+zlib - prefix: /opt/homebrew/opt/python + - spec: python@3.9 + prefix: /usr tar: buildable: false externals: - spec: tar@3.5.3 prefix: /usr - readline: - buildable: false - externals: - - spec: readline@8.2.10 - prefix: /opt/homebrew unzip: buildable: false externals: - spec: unzip@6.0 prefix: /usr - zlib: + + # Devtools (optional) + cppcheck: + version: [2.15.0] buildable: false externals: - - spec: zlib@1.3.1 + - spec: cppcheck@2.15.0 prefix: /opt/homebrew - - # The "::" removes all found/known compilers from Spack except for these. - compilers:: - - compiler: - spec: clang@=18.1.8 - paths: - cc: /opt/homebrew/opt/llvm/bin/clang - cxx: /opt/homebrew/opt/llvm/bin/clang++ - f77: /opt/homebrew/bin/gfortran-14 - fc: /opt/homebrew/bin/gfortran-14 - flags: {} - operating_system: sonoma - target: aarch64 - modules: [] - environment: {} - extra_rpaths: - - /opt/homebrew/lib/gcc/14 + doxygen: + version: [1.12.0] + buildable: false + externals: + - spec: doxygen@1.12.0 + prefix: /opt/homebrew + llvm: + version: [14.0.6] + buildable: false + externals: + - spec: llvm+clang@14.0.6 + prefix: /opt/homebrew/opt/llvm@14 + py-sphinx: + buildable: false + externals: + - spec: py-sphinx@7.4.7 + prefix: /Users/chapman39/dev/serac/venv + py-ats: + buildable: false + externals: + - spec: py-ats@7.0.105 + prefix: /Users/chapman39/dev/serac/venv diff --git a/src/docs/sphinx/dev_guide/index.rst b/src/docs/sphinx/dev_guide/index.rst index 1afba733c..544657256 100644 --- a/src/docs/sphinx/dev_guide/index.rst +++ b/src/docs/sphinx/dev_guide/index.rst @@ -24,6 +24,7 @@ Developer Guide codevelop state_manager equation_solver + macmini Developing a New Physics Module ------------------------------- diff --git a/src/docs/sphinx/dev_guide/macmini.rst b/src/docs/sphinx/dev_guide/macmini.rst new file mode 100644 index 000000000..de1cca7d2 --- /dev/null +++ b/src/docs/sphinx/dev_guide/macmini.rst @@ -0,0 +1,61 @@ +.. ## Copyright (c) 2019-2024, Lawrence Livermore National Security, LLC and +.. ## other Serac Project Developers. See the top-level COPYRIGHT file for details. +.. ## +.. ## SPDX-License-Identifier: (BSD-3-Clause) + +.. _macmini-label: + +========================================== +Adding an Additional User to Serac MacMini +========================================== + +This page assumes you are a Serac developer who requires access to the team's shared MacMini. This machine +tests Serac Mac builds on a regular basis via cron. If you have any questions, reach out to either +`Brandon Talamini `_, `Alex Chapman `_, or LivIT. The following +are steps to guide you to gaining access on the machine to the point you're able to build Serac. + +1. **Add User** + +Without a MyPass, you can still log in using your LLNL username and AD password. Do this first to setup an account on the machine. +You won't be able to do much, since you do not have access to FileVault, and you are not an admin... yet. + +2. **MyPass** + +Then, acquire a new MyPass with a USB-C port dedicated to this machine. This will grant you access to FileVault. +Contact LivIT directly to setup an appointment and request one. + +3. **EARS Admin Request** + +Next, request admin access to the machine by visiting either ServiceNow or the `EARS website `_. + +4. **Two Logins** + +Once you have a MyPass and you have admin rights, try to log in again. There should be two passwords required to log in. The first one +is for your MyPass (assuming it's plugged into to the machine) and the other is for the account login. + +5. **Download and setup Brew** + +Visit `Brew's website `_ to install and setup Brew. This is required to install some of Serac's third-party libraries +(TPLs). + +6. **Add New SSH Key to GitHub** + +Next step setting up a new SSH Key to your GitHub account so that you're able to clone the Serac repo. In case you do not know +how to do this, instructions can be found on +`GitHub's website `_. + +7. **Install Serac** + +You're now able to clone Serac and get started with the installation process. Further instructions for doing so are currently on +the `quickstart page `_ of the Serac documentation. + +================ +Cron Job Example +================ + +The following is an example of a cron job that could be used to test a Mac build, assuming TPLs have been built for Serac. Run +``crontab -e`` to edit the cron file. + +.. code-block:: bash + + 0 7 * * 4 /Users/chapman39/dev/serac/ci/repo/scripts/shared-macmini/build-and-test.sh diff --git a/src/docs/sphinx/quickstart.rst b/src/docs/sphinx/quickstart.rst index 5cc629e2f..203f69d5d 100644 --- a/src/docs/sphinx/quickstart.rst +++ b/src/docs/sphinx/quickstart.rst @@ -275,21 +275,24 @@ must be specified using either: ``python3 scripts/uberenv/uberenv.py --spack-env-file=scripts/spack/configs/linux_ubuntu_18/spack.yaml --prefix=../path/to/install`` -Building Serac Dependencies on MacOS with Homebrew ---------------------------------------------------- +Building Serac Dependencies on MacOS +------------------------------------ + .. warning:: These instructions are in development, but have been tested for M2 MacBooks. Installing base dependencies using Homebrew ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Install the following packages using Homebrew. +Homebrew is recommended to install base dependencies due to it's stability. Relying on pure Spack historically leads to more failed builds. + +To start, install the following packages using Homebrew. .. code-block:: bash - $ brew install autoconf automake bzip2 clingo cmake gcc gettext gnu-sed graphviz hwloc lapack libx11 llvm m4 make ninja open-mpi openblas pkg-config python readline spack zlib + $ brew install autoconf automake bzip2 clingo cmake diffutils fmt gcc gettext gnu-sed graphviz hwloc lapack libx11 llvm@14 m4 make ninja open-mpi openblas pkg-config readline zlib -If you plan to install the developer tools, you should also run +If you plan to install the developer tools, you should also run: .. code-block:: bash @@ -308,10 +311,11 @@ This is also useful for a few additional packages: .. code-block:: bash - $ export PATH="/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/m4/bin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH" + $ export PATH="/opt/homebrew/opt/llvm@14/bin:/opt/homebrew/opt/m4/bin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH" Configuring Spack ^^^^^^^^^^^^^^^^^ + In order to build Serac, we must define a ``spack.yaml`` file which tells Spack what packages we have installed. You will likely need to update the versions of packages in the provided example script ``scripts/spack/configs/macos_sonoma_aarch64/spack.yaml`` to match the versions installed by Homebrew. The versions for all installed packages can be listed via: @@ -325,35 +329,70 @@ Note that the version format output by the above command is not the same as that If you are not using an M2 or M3 Mac, you will need to change the ``target`` for the compiler to ``x86_64`` or ``aarch64`` for Intel and M1-based Macs, respectively. Similarly, you need to set the ``operating_system`` to the proper value if you are not using ``sonoma`` (MacOS 14.X). -If you want to install the devtools, you should also add the following under ``packages`` in the ``spack.yaml`` files. +Installing Python Developer Tools +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This step is only required if you wish to use Serac's developer tools. In order to use Python devtools, you will need to create a Python venv. This is much more reliable than having Spack install 20+ Python packages. +In this example, we are using the builtin Python in ``/usr/bin``, but it is possible to use a version installed from Brew or elsewhere. + +Next, you will need to install wheel, sphinx, and `ATS `_: + +.. code-block:: bash + + python3 -m venv --system-site-packages venv + source venv/bin/activate + pip install wheel + pip install sphinx + git clone git@github.com:LLNL/ATS.git --branch 7.0.105 + pip install ATS/ + +Keep track of the sphinx version while installing, since you'll need it for the next step. + +Adding Developer Tools to Spack Environment File +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Again, skip this step if not using devtools. After setting up a Python venv, you should add the following under ``packages`` in the ``spack.yaml`` files. Versions may vary. .. code-block:: yaml - # optional, for dev tools - cppcheck: - version: [2.14.2] - buildable: false - externals: - - spec: cppcheck@2.14.2 - prefix: /opt/homebrew - doxygen: - version: [1.11.0] - buildable: false - externals: - - spec: doxygen@1.11.0 - prefix: /opt/homebrew + # Devtools (optional) + cppcheck: + version: [2.15.0] + buildable: false + externals: + - spec: cppcheck@2.15.0 + prefix: /opt/homebrew + doxygen: + version: [1.12.0] + buildable: false + externals: + - spec: doxygen@1.12.0 + prefix: /opt/homebrew + llvm: + version: [14.0.6] + buildable: false + externals: + - spec: llvm+clang@14.0.6 + prefix: /opt/homebrew/opt/llvm@14 + py-sphinx: + buildable: false + externals: + - spec: py-sphinx@7.4.7 + prefix: /path/to/venv + py-ats: + buildable: false + externals: + - spec: py-ats@7.0.105 + prefix: /path/to/venv Building dependencies ^^^^^^^^^^^^^^^^^^^^^ -The invocation of ``uberenv.py`` is slightly modified from the standard instructions above in order to force the use of the Homebrew-installed MPI and compilers: +Uberenv is a Spack wrapper simplifing the TPL build process. The invocation of ``uberenv.py`` is slightly modified from the standard instructions above in order to force the use of the Homebrew-installed MPI and compilers: .. code-block:: bash - $ ./scripts/uberenv/uberenv.py --spack-env-file=scripts/spack/configs/macos_sonoma_aarch64/spack.yaml --prefix=../path/to/install --spec="%clang@18.1.8 ^openmpi@5.0.3_1" + $ ./scripts/uberenv/uberenv.py --spack-env-file=/path/to/spack.yaml --prefix=/path/to/install --spec="%clang@14 ^openmpi@5" -Note: If you want to build with PETSc, you should instead use the command - -.. code-block:: bash - - $ ./scripts/uberenv/uberenv.py --spack-env-file=scripts/spack/configs/macos_sonoma_aarch64/spack.yaml --prefix=../path/to/install --spec="+petsc %clang@18.1.8 ^openmpi@5.0.3_1 ^petsc+tetgen+scalapack+strumpack" +.. note:: + To build with devtools and profiling enabled, change the spec to ``"%clang@14+devtools+profiling ^openmpi@5"`` diff --git a/src/serac/physics/boundary_conditions/tests/boundary_cond.cpp b/src/serac/physics/boundary_conditions/tests/boundary_cond.cpp index 71ea40c53..6f0496843 100644 --- a/src/serac/physics/boundary_conditions/tests/boundary_cond.cpp +++ b/src/serac/physics/boundary_conditions/tests/boundary_cond.cpp @@ -42,50 +42,6 @@ TEST(BoundaryCond, SimpleRepeatedDofs) MPI_Barrier(MPI_COMM_WORLD); } -TEST(BoundaryCond, DirectTrueDofs) -{ - MPI_Barrier(MPI_COMM_WORLD); - constexpr int N = 15; - auto mesh = mfem::Mesh::MakeCartesian2D(N, N, mfem::Element::TRIANGLE); - mfem::ParMesh par_mesh(MPI_COMM_WORLD, mesh); - FiniteElementState state(par_mesh, H1<1>{}); - - BoundaryConditionManager bcs(par_mesh); - - mfem::Vector vec(2); - vec = 1.0; - - auto coef = std::make_shared(vec); - - mfem::Array true_dofs; - - int rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - - if (rank == 0) { - true_dofs.SetSize(1); - true_dofs[0] = 1; - } else if (rank == 1) { - true_dofs.SetSize(2); - true_dofs[0] = 5; - true_dofs[1] = 48; - } - - bcs.addEssential(true_dofs, coef, state.space()); - auto local_dofs = bcs.allEssentialLocalDofs(); - - local_dofs.Sort(); - - if (rank == 0) { - EXPECT_EQ(local_dofs.Size(), 1); - EXPECT_EQ(local_dofs[0], 1); - } else if (rank == 1) { - EXPECT_EQ(local_dofs.Size(), 2); - EXPECT_EQ(local_dofs[0], 6); - EXPECT_EQ(local_dofs[1], 53); - } -} - TEST(BoundaryCondHelper, ElementAttributeDofListScalar) { MPI_Barrier(MPI_COMM_WORLD);