Running julia with gprof (or other C profiler)

222 views
Skip to first unread message

Tim Holy

unread,
Jan 3, 2016, 8:47:54 PM1/3/16
to julia-dev
Does anyone have experience with profiling julia's C code? The built-in profiler
collects information about ccalls, but we can't handle the instruction
pointer/line number very well so it's not very informative. I tried compiling
julia with -pg but, upon running my test script, did not get a gmon.out file.

Best,
--Tim

Details about what I tried:

~/src/julia$ git diff
diff --git a/src/Makefile b/src/Makefile
index 4629ff9..7cb8282 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,7 +20,8 @@ FLAGS := \
ifneq ($(USEMSVC), 1)
FLAGS += -Wall -Wno-strict-aliasing -fno-omit-frame-pointer -
fvisibility=hidden -fno-common
-Wpointer-arith -Wundef
-override CFLAGS += -Wold-style-definition -Wstrict-prototypes -Wc++-compat
+override CFLAGS += -Wold-style-definition -Wstrict-prototypes -Wc++-compat -pg
+LDFLAGS += -pg
endif

~/src/julia$ touch src/julia.h
~/src/julia$ make debug
~/src/julia$ cd test
~/src/julia/test$ ../julia -e 'using Base.Test; include("subarray.jl")'

("subarray.jl" turns out to be a stress-test for the compiler, specifically for
jl_egal, and I'd like to see if there's anything that can be done to make it
faster.)

Kristoffer Carlsson

unread,
Jan 4, 2016, 9:42:04 AM1/4/16
to julia-dev
If you are able to get access, I would recommend the Intel Vtune profiler.

I ran a bit of the subarray test and did some screenshots:

Stuff called from jl_egal

Bottom up call stack:

In source view with timings:


Kristoffer Carlsson

unread,
Jan 4, 2016, 9:44:30 AM1/4/16
to julia-dev
The line numbers might be wrong in my screenshots because I didnt apply the patch Arch wrote in the intel blog post I linked in the end.


On Monday, January 4, 2016 at 2:47:54 AM UTC+1, Tim Holy wrote:

Tim Holy

unread,
Jan 4, 2016, 10:50:04 AM1/4/16
to juli...@googlegroups.com
On Monday, January 04, 2016 06:44:30 AM Kristoffer Carlsson wrote:
> The line numbers might be wrong in my screenshots because I didnt apply the
> patch Arch wrote in the intel blog post I linked in the end.

A huge help nonetheless, and it confirms the suspicions I raised in
https://github.com/JuliaLang/julia/issues/14556. Many thanks!

I'll look into whether I can get VTune.

--Tim
Reply all
Reply to author
Forward
0 new messages