Skip to content

Add run-time interface for build-time configuration#1792

Merged
jeremylt merged 6 commits intomainfrom
jed/runtime-config
Mar 26, 2025
Merged

Add run-time interface for build-time configuration#1792
jeremylt merged 6 commits intomainfrom
jed/runtime-config

Conversation

@jedbrown
Copy link
Member

This provides the interfaces requested in #1732

@jedbrown jedbrown requested a review from jeremylt March 22, 2025 05:40
@jedbrown jedbrown force-pushed the jed/runtime-config branch from 239b595 to 681b597 Compare March 22, 2025 05:41
@jrwrigh
Copy link
Collaborator

jrwrigh commented Mar 22, 2025

IDK if it's relevant for this feature, but if I try and run git describe --dirty on libCEED main, then I get an error:

fatal: No names found, cannot describe anything.

I didn't get this error when I ran it on a branch initially, but now it only returns the error after pulling main.

Edit:
pulling this branch gets the same thing.

$ make print-GIT_DESCRIBE
[ variable name]: GIT_DESCRIBE
[        origin]: file
[        flavor]: recursive
[         value]: $(shell git describe --dirty || printf "unknown\n")
fatal: No names found, cannot describe anything.
[expanded value]: unknown

This is with git version 2.49.0 on Arch. Not sure if that makes a difference.

Edit 2:
Resolved above: #1792 (comment)

@jeremylt jeremylt force-pushed the jed/runtime-config branch from b56a17d to 8edc248 Compare March 25, 2025 15:26
This adds CeedGetGitVersion() to access output of `git describe --dirty`
and CeedGetBuildConfiguration() to get variables like compilers and
flags.

For builds without a Git repo, we return "unknown" or the user can set
the string via `make GIT_DESCRIBE=deadbeaf`.
@jeremylt jeremylt force-pushed the jed/runtime-config branch 3 times, most recently from cc4fdef to e01c415 Compare March 25, 2025 19:10
@jeremylt jeremylt requested a review from jrwrigh March 25, 2025 20:55
@jeremylt jeremylt force-pushed the jed/runtime-config branch 2 times, most recently from cef960b to 9a896d0 Compare March 25, 2025 21:01
@jeremylt jeremylt force-pushed the jed/runtime-config branch from 9a896d0 to d7fa60a Compare March 25, 2025 21:02
@jeremylt
Copy link
Member

Issue was that old versions of make do not have file as a command.

With these changes:

$ ./build/t010-config /cpu/self
Git: v0.12.0-969-gd7fa60a8-dirty
CC = gcc
CXX = g++
FC = gfortran
NVCC = /bin/nvcc
NVCC_CXX = g++
HIPCC = /bin/hipcc
OPT = -O -march=native -g -ffp-contract=fast -fopenmp-simd
CFLAGS = -O -march=native -g -ffp-contract=fast -fopenmp-simd -fPIC -std=c99 -Wall -Wextra -Wno-unused-parameter -MMD -MP  
CPPFLAGS = -I./include
CXXFLAGS = -O -march=native -g -ffp-contract=fast -fopenmp-simd -fPIC -std=c++11 -Wall -Wextra -Wno-unused-parameter -MMD -MP 
FFLAGS = -O -march=native -g -ffp-contract=fast -fopenmp-simd -fPIC -cpp -Wall -Wextra -Wno-unused-parameter -Wno-unused-dummy-argument -MMD -MP 
NVCCFLAGS = -ccbin g++ -Xcompiler '-O -march=native -g -ffp-contract=fast -fopenmp-simd' -Xcompiler -fPIC
HIPCCFLAGS = -O -march=native -g -ffp-contract=fast -fPIC -munsafe-fp-atomics
SYCLFLAGS =  -fPIC -std=c++17 -O -march=native -g -ffp-contract=fast -fopenmp-simd -fPIC -Wall -Wextra -Wno-unused-parameter -MMD -MP -O -march=native -g -ffp-contract=fast
AR = ar
ARFLAGS = crD
LDFLAGS = -Wl,-rpath,/home/jeremy/Dev/libCEED/lib -Llib
LDLIBS = 
LIBCXX = -lstdc++
SED = sed
MAGMA_DIR = ../magma
OCCA_DIR = ../occa/install
XSMM_DIR = ../libxsmm
CUDA_DIR = 
CUDA_ARCH = 
MFEM_DIR = ../mfem
PETSC_DIR = 
NEK5K_DIR = /home/jeremy/Dev/Nek5000
ROCM_DIR = 
HIP_ARCH = 
SYCL_DIR = 

@jeremylt jeremylt force-pushed the jed/runtime-config branch 2 times, most recently from d224447 to 518f111 Compare March 25, 2025 21:46
@jeremylt jeremylt force-pushed the jed/runtime-config branch from c22b1ae to 518f111 Compare March 25, 2025 22:17
@jeremylt jeremylt force-pushed the jed/runtime-config branch from 518f111 to 944f002 Compare March 25, 2025 22:22
@jeremylt jeremylt merged commit b4e8f36 into main Mar 26, 2025
29 checks passed
@jeremylt jeremylt deleted the jed/runtime-config branch March 26, 2025 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants