Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,6 @@ if(METACG_BUILD_CGCOLLECTOR)
add_subdirectory(cgcollector)
endif()

# Build CGPatch: cgpatch-pass, cgpatch-runtime, wrappers, tests
option(
METACG_BUILD_CGPATCH
"On or off"
OFF
)
if(METACG_BUILD_CGPATCH)
if(NOT METACG_BUILD_GRAPH_TOOLS)
message(FATAL_ERROR "CGPatch requires to build with METACG_BUILD_GRAPH_TOOLS=ON")
endif()
if(${LLVM_PACKAGE_VERSION}
GREATER
14
)
add_subdirectory(tools/cgpatch/)
else()
message(STATUS "Skipping CGPatch: requires LLVM version 15 or higher")
endif()
endif()
# PIRA analyzer Should PGIS be built
option(
METACG_BUILD_PGIS
Expand All @@ -151,18 +132,6 @@ option(
OFF
)

# Enable MPI for CGPatch
option(
CGPATCH_USE_MPI
"On or Off"
ON
)

if(METACG_BUILD_CGPATCH AND CGPATCH_USE_MPI)
find_package(MPI REQUIRED)
message(STATUS "MPI VERSION: ${MPI_C_VERSION}")
endif()

# Build MetaCG's Python interface
option(
METACG_BUILD_PYMETACG
Expand Down
17 changes: 17 additions & 0 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Build CGPatch: cgpatch-pass, cgpatch-runtime, wrappers, tests
option(
METACG_BUILD_CGPATCH
"On or off"
OFF
)
if(METACG_BUILD_CGPATCH)
if(${LLVM_PACKAGE_VERSION}
GREATER
14
)
add_subdirectory(cgpatch)
else()
message(WARNING "Skipping CGPatch: requires LLVM version 15 or higher")
endif()
endif()

add_subdirectory(cgcollector2)
add_subdirectory(cgmerge2)
add_subdirectory(cgconvert)
Expand Down
15 changes: 13 additions & 2 deletions tools/cgpatch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
project(CGPatch)

include(GNUInstallDirs)

# Enable MPI for CGPatch
option(
CGPATCH_USE_MPI
"On or Off"
ON
)

if(CGPATCH_USE_MPI)
find_package(MPI REQUIRED)
message(STATUS "MPI VERSION: ${MPI_C_VERSION}")
endif()

# LLVM
option(
USE_FNO_RTTI
Expand Down Expand Up @@ -33,6 +43,7 @@ foreach(tgt cgpatch-call-analysis cgpatch-inst-pass)
endforeach()

if(CGPATCH_USE_MPI)
target_include_directories(cgpatch-runtime PRIVATE ${MPI_C_INCLUDE_DIRS})
target_compile_definitions(cgpatch-runtime PRIVATE USE_MPI=1)
endif()

Expand Down
15 changes: 11 additions & 4 deletions tools/cgpatch/test/integration/CGPIntegrationRunner.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ cgmerge2Exe="$buildDir/tools/cgmerge2/cgmerge2"
outputDir=$buildDir/tools/cgpatch/test/integration


if [ "$CGPATCH_USE_MPI" == "ON" ]; then
compiler=mpicxx
else
compiler=clang++
fi


if [ ! -d "${logDir}" ]; then
mkdir "${logDir}"
fi
Expand All @@ -71,14 +78,14 @@ function build_and_run_mpi_testcase {
local testDir="$3"
local testExe="$outputDir/${testName}.out"
local testPG="$outputDir/${testName}.pg"
local testGT="$test_root/input/mpi/{testName}.gtpg"
local testGT="$test_root/input/mpi/${testName}.gtpg"
local testMCG="$outputDir/${testName}.mcg"
local testSCG="$test_root/input/general/${testName}.ipcg"
local testSCG="$test_root/input/mpi/${testName}.ipcg"

export CGPATCH_CG_NAME="${testPG}"

log "Compiling MPI testcase: $testSources"
$cgpatchExe mpicxx $testSources -o "$testExe" >> "$logFile"
$cgpatchExe $compiler $testSources -o "$testExe" >> "$logFile"
if [ $? -ne 0 ]; then
echo "Compilation failed for $testName"
fails=$((fails + 1))
Expand Down Expand Up @@ -109,7 +116,7 @@ function build_and_run_regular_testcase {
export CGPATCH_CG_NAME="${testPG}"

log "Compiling regular testcase: $testSources"
$cgpatchExe clang++ $testSources -o "$testExe" >> "$logFile"
$cgpatchExe $compiler $testSources -o "$testExe" >> "$logFile"
if [ $? -ne 0 ]; then
echo "Compilation failed for $testName"
fails=$((fails + 1))
Expand Down