Fixing Build Library Paths

Change-Id: If71f548dda3dd7cab3dc251b4a3e6389cfc9e4f9
Dieser Commit ist enthalten in:
Ammar ELWazir
2023-06-09 04:34:01 +00:00
committet von Ammar Elwazir
Ursprung 8350f42329
Commit 7ea04a63c5
3 geänderte Dateien mit 31 neuen und 5 gelöschten Zeilen
+8 -5
Datei anzeigen
@@ -68,6 +68,7 @@ while [ 1 ] ; do
elif [[ "$1" = "-t" || "$1" = "--test" ]] ; then
if [ $RUN_FROM_BUILD == 1 ]; then
export ROCPROFILER_METRICS_PATH=$ROCM_DIR/build/counters/derived_counters.xml
export LD_LIBRARY_PATH=$ROCPROFV2_DIR/build:$LD_LIBRARY_PATH
RUN_TEST=yes TO_CLEAN=no $ROCM_DIR/build.sh
if [ "$CURRENT_DIR/build" -ef "./build" ] ; then
./run_tests.sh
@@ -79,6 +80,7 @@ while [ 1 ] ; do
fi
elif [[ "$1" = "-mt" || "$1" = "--mem-test" ]] ; then
if [ $RUN_FROM_BUILD == 1 ]; then
export LD_LIBRARY_PATH=$ROCPROFV2_DIR/build:$LD_LIBRARY_PATH
ASAN=yes TO_CLEAN=yes ./build.sh
./tests-v2/memorytests/run_asan_tests.sh $ROCM_DIR/build/tests-v2/featuretests/profiler/apps/hip_vectoradd $ROCM_DIR/build/memleaks.log
exit 1
@@ -111,6 +113,7 @@ while [ 1 ] ; do
elif [[ "$1" = "--list-counters" ]] ; then
if [ $RUN_FROM_BUILD == 1 ]; then
export ROCPROFILER_METRICS_PATH=$ROCM_DIR/build/counters/derived_counters.xml
export LD_LIBRARY_PATH=$ROCPROFV2_DIR/build:$LD_LIBRARY_PATH
eval $ROCM_DIR/build/src/tools/ctrl
else
export ROCPROFILER_METRICS_PATH=$ROCPROFV2_DIR/../libexec/rocprofiler/counters/derived_counters.xml
@@ -123,6 +126,7 @@ while [ 1 ] ; do
if [ $2 ] && [ -n $2 ] && [ -r $2 ] ; then
if [ $RUN_FROM_BUILD == 1 ]; then
export ROCPROFILER_METRICS_PATH=$ROCM_DIR/build/counters/derived_counters.xml
export LD_LIBRARY_PATH=$ROCPROFV2_DIR/build:$LD_LIBRARY_PATH
else
export ROCPROFILER_METRICS_PATH=$ROCPROFV2_DIR/../libexec/rocprofiler/counters/derived_counters.xml
fi
@@ -204,11 +208,7 @@ while [ 1 ] ; do
usage
exit 1
fi
if [ $RUN_FROM_BUILD == 1 ]; then
export ROCPROFILER_PLUGIN_LIB=lib${PLUGIN}_plugin.so
else
export ROCPROFILER_PLUGIN_LIB=lib${PLUGIN}_plugin.so
fi
export ROCPROFILER_PLUGIN_LIB=lib${PLUGIN}_plugin.so
else
echo -e "Wrong input \"$2\" for plugin!"
usage
@@ -218,6 +218,7 @@ while [ 1 ] ; do
if [ $RUN_FROM_BUILD == 1 ]; then
ATT_PATH=$ROCPROFV2_DIR/build/plugin/att/att/att.py
export ROCPROFV2_ATT_LIB_PATH=$ROCM_PATH/lib/hsa-amd-aqlprofile/librocprofv2_att.so
export LD_LIBRARY_PATH=$ROCPROFV2_DIR/build:$LD_LIBRARY_PATH
else
ATT_PATH=$ROCPROFV2_DIR/../libexec/rocprofiler/att/att.py
export ROCPROFV2_ATT_LIB_PATH=$ROCPROFV2_DIR/../lib/hsa-amd-aqlprofile/librocprofv2_att.so
@@ -281,6 +282,7 @@ if [ -n "$PMC_LINES" ]; then
let COUNTER=COUNTER+1
fi
if [ $RUN_FROM_BUILD == 1 ]; then
export LD_LIBRARY_PATH=$ROCPROFV2_DIR/build:$LD_LIBRARY_PATH
LD_PRELOAD=$LD_PRELOAD:$ROCM_DIR/build/librocprofiler_tool.so $*
else
LD_PRELOAD=$LD_PRELOAD:$ROCM_DIR/lib/rocprofiler/librocprofiler_tool.so $*
@@ -288,6 +290,7 @@ if [ -n "$PMC_LINES" ]; then
done
elif [ ! -n "$ATT_ARGV" ]; then
if [ $RUN_FROM_BUILD == 1 ]; then
export LD_LIBRARY_PATH=$ROCPROFV2_DIR/build:$LD_LIBRARY_PATH
LD_PRELOAD=$LD_PRELOAD:$ROCM_DIR/build/librocprofiler_tool.so $*
else
LD_PRELOAD=$LD_PRELOAD:$ROCM_DIR/lib/rocprofiler/librocprofiler_tool.so $*
@@ -43,6 +43,7 @@ std::string golden_trace_path;
std::string test_app_path;
std::string metrics_path;
std::string binary_path;
std::string profiler_api_lib_path = "";
static void init_test_path() {
if (is_installed_path()) {
@@ -52,6 +53,7 @@ static void init_test_path() {
test_app_path = "share/rocprofiler/tests/featuretests/profiler/apps/";
metrics_path = "lib/rocprofiler/gfx_metrics.xml";
binary_path = "bin/rocprofv2";
profiler_api_lib_path = "/lib";
} else {
running_path = "tests-v2/featuretests/profiler/runFeatureTests";
lib_path = "librocprofiler_tool.so";
@@ -73,6 +75,14 @@ void ApplicationParser::SetApplicationEnv(const char* app_name) {
app_path = GetRunningPath(running_path);
std::stringstream ld_library_path;
ld_library_path << app_path << profiler_api_lib_path << []() {
const char* path = getenv("LD_LIBRARY_PATH");
if (path != nullptr) return ":" + std::string(path);
return std::string("");
}();
setenv("LD_LIBRARY_PATH", ld_library_path.str().c_str(), true);
std::stringstream counter_path;
counter_path << app_path << golden_trace_path << "input.txt";
setenv("COUNTERS_PATH", counter_path.str().c_str(), true);
@@ -31,6 +31,19 @@ THE SOFTWARE.
void ApplicationParser::SetApplicationEnv(const char* app_name, const char* trace_option) {
std::string app_path = GetRunningPath("tests-v2/featuretests/tracer/runTracerFeatureTests");
std::string profiler_api_lib_path = "";
if(is_installed_path()) {
profiler_api_lib_path = "/lib";
}
std::stringstream ld_library_path;
ld_library_path << app_path << profiler_api_lib_path << []() {
const char* path = getenv("LD_LIBRARY_PATH");
if (path != nullptr) return ":" + std::string(path);
return std::string("");
}();
setenv("LD_LIBRARY_PATH", ld_library_path.str().c_str(), true);
std::stringstream hsa_tools_lib_path;
hsa_tools_lib_path << app_path << "librocprofiler_tool.so";
setenv("LD_PRELOAD", hsa_tools_lib_path.str().c_str(), true);