Skip to content

Commit

Permalink
example evaluating TMCMC samples with umbridge
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdebus committed Jun 4, 2023
1 parent 92ecbb2 commit cf1732a
Show file tree
Hide file tree
Showing 14 changed files with 39,760 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ add_subdirectory (ops)
add_subdirectory (kle_ex1)
add_subdirectory (line_infer)
add_subdirectory (tmcmc_bimodal)
add_subdirectory (tmcmc_umbridge)
add_subdirectory (pce_bcs)
add_subdirectory (surf_rxn)
add_subdirectory (uqpc)
Expand Down
6 changes: 6 additions & 0 deletions examples/README
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ uqpc
==============================
construct Polynomial Chaos surrogates for multiple outputs/functions

==============================
um_bridge
==============================
Uses C++ TMCMC to sample from multimodal posterior, and um-bridge
to evaluate samples from a python function


==============================
iuq
Expand Down
68 changes: 68 additions & 0 deletions examples/tmcm_umbridge/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
project (UQTk)

SET(copy_FILES
tmcmc_getLL.sh
tmcmc_getLP.sh
tmcmc_moveIntermediateFiles.sh
tmcmc_prior_samples.dat
tmcmc_umbridge.py
minimal-umbridge-model.py
README
)

link_directories(${CMAKE_SUNDIALS_DIR}/lib)

add_executable (umbridge_model.x umbridge_model.cpp)
add_executable (tmcmc_umbridge.x tmcmc_umbridge.cpp)

target_link_libraries (tmcmc_umbridge.x uqtk )
target_link_libraries (tmcmc_umbridge.x depdsfmt )
target_link_libraries (tmcmc_umbridge.x depslatec)
target_link_libraries (tmcmc_umbridge.x deplbfgs )


# Link fortran libraries
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# using GCC
target_link_libraries (tmcmc_umbridge.x gfortran expat stdc++)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# using Intel
if ("${IntelLibPath}" STREQUAL "")
target_link_libraries (tmcmc_umbridge.x ifcore ifport)
else()
target_link_libraries (tmcmc_umbridge.x ${IntelLibPath}/libifcore.a)
target_link_libraries (tmcmc_umbridge.x ${IntelLibPath}/libifport.a)
endif()
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# using Clang
if ("${ClangLibPath}" STREQUAL "")
target_link_libraries (tmcmc_umbridge.x gfortran stdc++)
else()
target_link_libraries (tmcmc_umbridge.x ${ClangLibPath}/libgfortran.dylib ${ClangLibPath}/libstdc++.dylib)
endif()
endif()

target_link_libraries (tmcmc_umbridge.x m lapack)
target_link_libraries (tmcmc_umbridge.x m blas)

include_directories(../../examples/tmcmc_umbridge)

include_directories(../../cpp/lib/pce )
include_directories(../../cpp/lib/array )
include_directories(../../cpp/lib/include)
include_directories(../../cpp/lib/quad )
include_directories(../../cpp/lib/tools )
include_directories(../../cpp/lib/mcmc )
include_directories(../../cpp/lib/tmcmc )

include_directories(../../dep/dsfmt)
include_directories(../../dep/slatec)
include_directories(../../dep/lbfgs)


INSTALL(TARGETS tmcmc_umbridge.x DESTINATION examples/tmcmc_umbridge)
INSTALL(TARGETS umbridge_model.x DESTINATION examples/tmcmc_umbridge)

INSTALL(FILES ${copy_FILES}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
DESTINATION examples/tmcmc_umbridge)
32 changes: 32 additions & 0 deletions examples/tmcm_umbridge/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
tmcmc_bimodal example


contains example for sampling of 3-dimensional bimodal posterior probability density using TMCMC. The C++ libraries are called directly from the driver program.
By changing the likelihood function and the prior function in bimodal.cpp, this program can be tailored to other inference problems.

================================================================================
Files

tmcmc_bimodal.py: main scripts

tmcmc_bimodal.cpp: C++ code that produces some of the needed functions -
sets up the MCMC class object, specifying the
dimensionality of the problem, number of
samples required, number of processes for
parallel evaluation of likelihood and prior

bimodal.cpp: C++ code for evaluating the likelihood and prior pdfs -
the corresponding executable is invoked
multiple times for parallel evaluation
of likelihood and prior pdfs

tmcmc_prior_samples.dat: samples from prior pdf (as required by TMCMC) -
3D Normal prior for this example with 5000
samples

tmcmc_getLL.sh: Shell script that spawns multiple processes for parallel
evaluation of likelihood function
tmcmc_getLP.sh Shell script that spawns multiple processes for parallel
evaluation of prior PDF
tmcmc_moveIntermediateFiles.sh: Shell script used for moving all
artifacts of TMCMC into a subdirectory
Loading

0 comments on commit cf1732a

Please sign in to comment.