Skip to content

Commit

Permalink
Merge pull request #126 from gvallee/issue116
Browse files Browse the repository at this point in the history
Addresses #116 - tool to make it easier to get a trace
  • Loading branch information
gvallee authored Feb 22, 2021
2 parents a83305a + 82839a1 commit 8cc32e6
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 3 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,15 @@ clean:
validate: clean check_gnuplot all
# postmortem validates both the profiler's capabilities and postmortem analysis
cd tools/cmd/validate; ./validate -postmortem

install-go:
ifndef GOCMD
@echo "Installing Go 1.13 for Linux into your home directory..."
`cd ${HOME}; wget https://golang.org/dl/go1.13.15.linux-amd64.tar.gz && tar xzf go1.13.15.linux-amd64.tar.gz`
@echo "Please add the following to your .bashrc:"
@echo "export GOPATH=$HOME/go"
@echo "export PATH=$GOPATH/bin:$PATH"
@echo "export LD_LIBRARY_PATH=$GOPATH/lib:$LD_LIBRARY_PATH"
else
@echo "Go already installed"
endif
6 changes: 5 additions & 1 deletion tools/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright (c) 2020-2021 NVIDIA CORPORATION. All rights reserved.

all: webui map profile sendprofiler recvprofiler getcounters validate srcountsanalyzer analyzetimings analyzebacktraces getcalldata getbins
all: webui map profile sendprofiler recvprofiler getcounters validate srcountsanalyzer analyzetimings analyzebacktraces getcalldata getbins profilerrun

profilerrun:
cd cmd/profilerrun; go build profilerrun.go

webui:
cd cmd/webui; go build webui.go
Expand Down Expand Up @@ -66,3 +69,4 @@ clean:
@rm -f cmd/profile/profile
@rm -f cmd/map/map
@rm -f cmd/webui/webui
@rm -f cmd/profilerrun/profilerrun
44 changes: 44 additions & 0 deletions tools/cmd/profilerrun/profilerrun.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
//
// See LICENSE.txt for license information
//

package main

import (
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"

"github.com/gvallee/go_exec/pkg/advexec"
)

func main() {
_, filename, _, _ := runtime.Caller(0)
codeBaseDir := filepath.Join(filepath.Dir(filename), "..", "..", "..")

libraries := []string{"liballtoallv_counts.so", "liballtoallv_backtrace.so", "liballtoallv_exec_timings.so", "liballtoallv_late_arrival.so", "liballtoallv_location.so"}
for _, lib := range libraries {
cmdArgs := os.Args[1:]
libPath := filepath.Join(codeBaseDir, "src", "alltoallv", lib)
cmdArgs = append([]string{"-x", "LD_PRELOAD=" + libPath}, cmdArgs...)
var cmd advexec.Advcmd
mpirunPath, err := exec.LookPath("mpirun")
if err != nil {
fmt.Printf("unable to find mpirun: %s\n", err)
os.Exit(1)
}
cmd.BinPath = mpirunPath
cmd.CmdArgs = cmdArgs
cmd.Env = os.Environ()
fmt.Printf("Executing: %s %s\n", cmd.BinPath, cmd.CmdArgs)
res := cmd.Run()
if res.Err != nil {
fmt.Printf("Unable to run the command: %s - stdout: %s - stderr: %s\n", res.Err, res.Stdout, res.Stderr)
os.Exit(1)
}
}
}
1 change: 1 addition & 0 deletions tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ go 1.13

require (
github.com/gomarkdown/markdown v0.0.0-20200609195525-3f9352745725
github.com/gvallee/go_exec v0.0.4
github.com/gvallee/go_util v1.0.1
)
4 changes: 2 additions & 2 deletions tools/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/gomarkdown/markdown v0.0.0-20200609195525-3f9352745725 h1:X6sZdr+t2E2jwajTy/FfXbmAKPFTYxEq9hiFgzMiuPQ=
github.com/gomarkdown/markdown v0.0.0-20200609195525-3f9352745725/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU=
github.com/gvallee/go_util v1.0.0 h1:N1Op0Nscjv0mht2NJfGfMDe+2+ptfH1lKseb52jQkbY=
github.com/gvallee/go_util v1.0.0/go.mod h1:fTexpwdH/n05Ziu0TXJIQsr7E+46QpBxNdeOOsyC0/s=
github.com/gvallee/go_exec v0.0.4 h1:6xJ9iMMGP7gWFLWET6XpIdzov/9SqpZ9zpjHczSH24Q=
github.com/gvallee/go_exec v0.0.4/go.mod h1:4AwegK9oPhkgwkd0rjlTwxRw//8cW4pPcCSFLZ6+LZg=
github.com/gvallee/go_util v1.0.1 h1:Ch/PpAlHrHNmL2Upaxif/Nt4CqtaazDyTXh5fIhutJo=
github.com/gvallee/go_util v1.0.1/go.mod h1:fTexpwdH/n05Ziu0TXJIQsr7E+46QpBxNdeOOsyC0/s=
golang.org/dl v0.0.0-20190829154251-82a15e2f2ead/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ=

0 comments on commit 8cc32e6

Please sign in to comment.