Skip to content

Commit

Permalink
Merge branch 'salt-fm' of github.com:ParaToolsInc/salt into salt-fm
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaimov committed Dec 12, 2024
2 parents cf5499c + 4beb1cb commit 64d32e8
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ if(MLIR_FOUND AND Flang_FOUND)

install(TARGETS salt-flang-plugin DESTINATION lib)

configure_file(${CMAKE_SOURCE_DIR}/src/fparse-llvm.in ${CMAKE_BINARY_DIR}/fparse-llvm @ONLY)
install(PROGRAMS ${CMAKE_BINARY_DIR}/fparse-llvm
TYPE BIN)

else()
message(STATUS "Flang not found -- skipping Flang frontend plugin")
endif()
Expand Down Expand Up @@ -593,3 +597,26 @@ endfunction()
foreach(test_source IN LISTS TESTS_LIST)
compile_instrumented(${test_source})
endforeach()

# Add some Fortran tests for SALT-FM
set(FORTRAN_TESTS_SOURCES_LIST
myhi.f
cubes.f
emptyprog.f90
funcsub.f90
hello.f90
loop_test.f90
trivial.f90
)

foreach(test_source IN LISTS FORTRAN_TESTS_SOURCES_LIST)
add_test(NAME instrument_${test_source}
COMMAND ./fparse-llvm ${CMAKE_SOURCE_DIR}/tests/fortran/${test_source}
)
set_tests_properties(instrument_${test_source}
PROPERTIES
REQUIRED_FILES "${CMAKE_BINARY_DIR}/fparse-llvm"
ENVIRONMENT "SALT_FORTRAN_CONFIG_FILE=${CMAKE_SOURCE_DIR}/config_files/tau_fortran_config.yaml"
PASS_REGULAR_EXPRESSION "SALT Instrumentor Plugin finished"
)
endforeach()
25 changes: 25 additions & 0 deletions src/fparse-llvm.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

# Copyright (C) 2024, ParaTools, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


set -o errexit
set -o nounset
set -o pipefail
#set -o verbose
#set -o xtrace

# This script invokes an LLVM flang frontend plugin to parse and instrument Fortran code
flang-new -fc1 -load ./libsalt-flang-plugin.so -plugin salt-instrument "${@}"
2 changes: 1 addition & 1 deletion tests/fortran/myhi.f
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ subroutine HELLOWORLD(iVal)
integer iVal

cc Do something here...
print *, "Iteration = ", iVal
print *, "Iteration = ", iVal
cc HelloWorld = iVal
end

Expand Down

0 comments on commit 64d32e8

Please sign in to comment.