On Mar 26, 2015 11:56 PM, "Geert Janssen" <gee...@gmail.com> wrote:
>
> I really like to start a discussion on porting Julia to the PowerPC (powerpc64le) platform.
> I have been working on this for several days now. My platform is a PowerNV system running
> Ubuntu Utopic Unicorn 14.10. uname tells me this:
> Linux XXXX 3.16.0-29-generic #39-Ubuntu SMP Mon Dec 15 22:29:07 UTC 2014 ppc64le ppc64le ppc64le GNU/Linux
>
> So far I have achieved the following:
> - Created a Make.user for this platform
> - Scrambled together all the dependencies and have them compiled and in .so form
Do you mind sharing your details here (which libraries are being used and which versions, as well as your Make.user)? In addition to potential troubleshooting usefulness, I've been hoping to do something similar (though in my case it's OpenBSD on PowerPC rather than GNU/Linux) and would love to see how you've gone about it (since you've definitely gotten further than I have).
> - Can build libjulia.so and have a julia executable:
> julia: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=bdbb7a443c6e540131d16e5c228a82a1840d5c6d, not stripped
>
> Next thing is bootstrapping julia to build sys.ji and sys.so files.
> That's where things run amok. I get a segmentation fault smack in the middle of
> processing strings.jl. I have tried all kinds of debugging approaches:
> - turned of garbage collection
> - change the order of includes in the sysimg.jl file
> - added jl_printfs/jl_static_show all over the C/C++ source code
> Also there is a strange hick-up occurring right after including osutils.jl.
> It seems like the program is stuck for several minutes and then continues.
> I saw identical behavior on a 32-bit x86 machine.
>
> I am still investigating.
> Any suggestions are much appreciated.
>
> Geert
I'm not particularly familiar with PowerNV; do you happen to know which CPU model it is exactly? /proc/cpuinfo might help with that identification.
I happen to have a G5 Power Mac and XServe (PowerPC 970); assuming I can get Ubuntu installed on one of them, and assuming there aren't particularly-significant differences CPU-wise, I can likely help test/troubleshoot once I know how to reproduce your environment.
-- Ryan S. Northrup
You should build master from scratch. Don't use system llvm.
Also there is a strange hick-up occurring right after including osutils.jl.
It seems like the program is stuck for several minutes and then continues.
I saw identical behavior on a 32-bit x86 machine.
On Mar 30, 2015 7:15 AM, "Geert Janssen" <gee...@gmail.com> wrote:
> Hence I resort to the system libm. Here is my Make.user file:
>
>
> USE_SYSTEM_LIBM=1
> USE_SYSTEM_BLAS=1
> USE_SYSTEM_LAPACK=1
> USE_SYSTEM_FFTW=1
> USE_SYSTEM_GMP=1
> USE_SYSTEM_MPFR=1
>
> # __PPC64__ defined but __ppc64__ is not!
> CFLAGS += -D__ppc64__
> CXXFLAGS += -D__ppc64__
> LDFLAGS = -llzma
> VERBOSE = 1
>
> LLVM_VER=3.6.0
>
Thanks for that. I'll see if I can reproduce (and if so, troubleshoot) on my own hardware).
-- Ryan
geert@tulgb001:~/src/julia/base$ gdb /gpfs/DDNgpfs1/geert/src/julia/usr/bin/julia-debug
GNU gdb (Ubuntu 7.8-1ubuntu4) 7.8.0.20141001-cvs
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc64le-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /gpfs/DDNgpfs1/geert/src/julia/usr/bin/julia-debug...done.
(gdb) r -C native --build /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys0 sysimg.jl
Starting program: /gpfs/DDNgpfs1/geert/src/julia/usr/bin/julia-debug -C native --build /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys0 sysimg.jl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/powerpc64le-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00003fffb7bf0080 in julia.new_0 ()
(gdb) bt
#0 0x00003fffb7bf0080 in julia.new_0 ()
#1 0x00003fffb7c7530c in jl_apply (f=0x3ffdb4870a38, args=0x3fffffffe098,
nargs=2) at julia.h:1261
#2 0x00003fffb7c7af40 in jl_trampoline (F=0x3ffdb4870a38,
args=0x3fffffffe098, nargs=2) at builtins.c:1010
#3 0x00003fffb7c65d88 in jl_apply (f=0x3ffdb4870a38, args=0x3fffffffe098,
nargs=2) at julia.h:1261
#4 0x00003fffb7c6d1ac in jl_apply_generic (F=0x3ffdb4870970,
args=0x3fffffffe098, nargs=2) at gf.c:1706
#5 0x00003fffb7d5beb4 in jl_apply (f=0x3ffdb4870970, args=0x3fffffffe098,
nargs=2) at julia.h:1261
#6 0x00003fffb7d5c55c in do_call (f=0x3ffdb4870970, args=0x3ffdb48690c8,
nargs=2, eval0=0x0, locals=0x0, nl=0, ngensym=0) at interpreter.c:64
#7 0x00003fffb7d5d454 in eval (e=0x3ffdb48709c0, locals=0x0, nl=0, ngensym=0)
at interpreter.c:214
#8 0x00003fffb7d5c144 in jl_interpret_toplevel_expr (e=0x3ffdb48709c0)
at interpreter.c:25
#9 0x00003fffb7d81904 in jl_toplevel_eval_flex (e=0x3ffdb4870998, fast=1)
at toplevel.c:502
#10 0x00003fffb7d81c90 in jl_parse_eval_all (fname=0x3fffb7df7918 "boot.jl")
at toplevel.c:550
#11 0x00003fffb7d81f2c in jl_load (fname=0x3fffb7df7918 "boot.jl")
at toplevel.c:589
#12 0x00003fffb7d6b468 in _julia_init (rel=JL_IMAGE_JULIA_HOME) at init.c:1009
#13 0x00003fffb7d6d5dc in julia_init (rel=JL_IMAGE_JULIA_HOME) at task.c:252
#14 0x0000000010003390 in main (argc=1, argv=0x3ffffffff8a0) at repl.c:482
(gdb)
...
version.jl
gmp.jl
error during bootstrap:
LoadError(at "sysimg.jl" line 173: LoadError(at "gmp.jl" line 24: ErrorException("error compiling gmp_version: could not load module libgmp: libgmp: cannot open shared object file: No such file or directory")))
rec_backtrace at /gpfs/DDNgpfs1/geert/src/julia/src/task.c:638
record_backtrace at /gpfs/DDNgpfs1/geert/src/julia/src/task.c:683
jl_throw at /gpfs/DDNgpfs1/geert/src/julia/src/task.c:798
jl_rethrow_with_add at /gpfs/DDNgpfs1/geert/src/julia/src/codegen.cpp:602
to_function at /gpfs/DDNgpfs1/geert/src/julia/src/codegen.cpp:625
jl_compile at /gpfs/DDNgpfs1/geert/src/julia/src/codegen.cpp:775
jl_trampoline_compile_function at /gpfs/DDNgpfs1/geert/src/julia/src/builtins.c:994
jl_trampoline at /gpfs/DDNgpfs1/geert/src/julia/src/builtins.c:1010
jl_apply at /gpfs/DDNgpfs1/geert/src/julia/src/julia.h:1261
jl_apply_generic at /gpfs/DDNgpfs1/geert/src/julia/src/gf.c:1706
jl_apply at /gpfs/DDNgpfs1/geert/src/julia/src/julia.h:1261
do_call at /gpfs/DDNgpfs1/geert/src/julia/src/interpreter.c:64
eval at /gpfs/DDNgpfs1/geert/src/julia/src/interpreter.c:214
eval at /gpfs/DDNgpfs1/geert/src/julia/src/interpreter.c:220
eval_body at /gpfs/DDNgpfs1/geert/src/julia/src/interpreter.c:575
jl_toplevel_eval_body at /gpfs/DDNgpfs1/geert/src/julia/src/interpreter.c:515
jl_toplevel_eval_flex at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:496
jl_eval_module_expr at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:148
jl_toplevel_eval_flex at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:394
jl_parse_eval_all at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:550
jl_load at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:589
jl_load_ at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:597
unknown function (ip: -1677459380)
jl_apply at /gpfs/DDNgpfs1/geert/src/julia/src/julia.h:1261
jl_apply_generic at /gpfs/DDNgpfs1/geert/src/julia/src/gf.c:1686
unknown function (ip: -1907752664)
jl_apply at /gpfs/DDNgpfs1/geert/src/julia/src/julia.h:1261
do_call at /gpfs/DDNgpfs1/geert/src/julia/src/interpreter.c:64
eval at /gpfs/DDNgpfs1/geert/src/julia/src/interpreter.c:214
jl_interpret_toplevel_expr at /gpfs/DDNgpfs1/geert/src/julia/src/interpreter.c:25
jl_toplevel_eval_flex at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:502
jl_eval_module_expr at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:148
jl_toplevel_eval_flex at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:394
jl_parse_eval_all at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:550
jl_load at /gpfs/DDNgpfs1/geert/src/julia/src/toplevel.c:589
unknown function (ip: 268447084)
unknown function (ip: 268447856)
unknown function (ip: 268448696)
unknown function (ip: -1640739200)
__libc_start_main at /lib/powerpc64le-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0)
Basic Block in function 'julia_gmp_version_5950' does not have terminator!
label %top
LLVM ERROR: Broken function found, compilation aborted!
Makefile:168: recipe for target '/gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys0.o' failed
make[1]: *** [/gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys0.o] Error 1
make[1]: Leaving directory '/gpfs/DDNgpfs1/geert/src/julia'
Makefile:82: recipe for target 'julia-sysimg-debug' failed
make: *** [julia-sysimg-debug] Error 2
geert@tulgb001:~/src/julia$
Wow, after some 1.5 hours it finally processed sysimg.jl and went into its second phase:
deprecated.jl
basedocs.jl
precompile.jl
g++ -shared -fPIC -L/gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia -L/gpfs/DDNgpfs1/geert/src/julia/usr/lib -L/gpfs/DDNgpfs1/geert/src/julia/usr/lib -o /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys0.so /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys0.o $([ Linux = Darwin ] && echo '' -Wl,-undefined,dynamic_lookup || echo '' -Wl,--unresolved-symbols,ignore-all ) $([ Linux = WINNT ] && echo '' -ljulia -lssp)
true -ignore /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys0.so
cd base && /gpfs/DDNgpfs1/geert/src/julia/usr/bin/julia-debug -C native --build /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys -J/gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/$([ -e /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys.ji ] && echo sys.ji || echo sys0.ji) -f sysimg.jl || { echo '*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***' && false; }
exports.jl
geert@tulgb001:~/src/julia$ ./julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.0-dev+4074 (2015-03-30 16:50 UTC)
_/ |\__'_|_|_|\__'_| | Commit dc9d7b6* (1 day old master)
|__/ | powerpc64le-linux-gnu
julia>
julia> names(Sys)
13-element Array{Symbol,1}:
:uptime
:cpu_info
:Sys
:OS_NAME
:cpu_summary
:cpu_name
:total_memory
:MACHINE
:CPU_CORES
:WORD_SIZE
:loadavg
:ARCH
:free_memory
julia> versioninfo()
Julia Version 0.4.0-dev+4074
Commit dc9d7b6* (2015-03-30 16:50 UTC)
DEBUG build
Platform Info:
System: Linux (powerpc64le-linux-gnu)
CPU: unknown
WORD_SIZE: 64
BLAS: libblas
LAPACK: liblapack
LIBM: libm
LLVM: libLLVM-3.6.0
So how do I know sys.so was loaded?
I do not see a Sys.dllist() function. I have this:
geert@tulgb001:~/src/juliageert@tulgb001:~/src/julia$ ./julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.0-dev+4074 (2015-03-30 16:50 UTC)
_/ |\__'_|_|_|\__'_| | Commit dc9d7b6* (1 day old master)
|__/ | powerpc64le-linux-
gnu
julia> Libdl.dllist()
signal (11): Segmentation fault
unknown function (ip: 0)
Segmentation fault
/gpfs/DDNgpfs1/geert/src/julia/usr/bin/julia --check-bounds=yes --startup-file=no ./runtests.jl all
Master process (id 1) could not connect within 60.0 seconds.
exiting.
Master process (id 1) could not connect within 60.0 seconds.
exiting.
Master process (id 1) could not connect within 60.0 seconds.
exiting.
Master process (id 1) could not connect within 60.0 seconds.
exiting.
Master process (id 1) could not connect within 60.0 seconds.
exiting.
Master process (id 1) could not connect within 60.0 seconds.
exiting.
Master process (id 1) could not connect within 60.0 seconds.
exiting.
Master process (id 1) could not connect within 60.0 seconds.
exiting.
Worker 2 terminated.
ERROR: LoadError: connect: connection refused (ECONNREFUSED)
while loading /gpfs/DDNgpfs1/geert/src/julia/test/runtests.jl, in expression starting on line 3
ERROR (unhandled task failure): EOFError: read end of file
Makefile:9: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/gpfs/DDNgpfs1/geert/src/julia/test'
Makefile:496: recipe for target 'testall' failed
make: *** [testall] Error 2
/gpfs/DDNgpfs1/geert/src/julia/usr/bin/julia --check-bounds=yes --startup-file=no ./runtests.jl core
* core in 1717.86 seconds
SUCCESS
make[1]: Leaving directory '/gpfs/DDNgpfs1/geert/src/julia/test'
void jl_gc_setmark(jl_value_t *v) // TODO rename this as it is misleading now
{
// int64_t s = perm_scanned_bytes;
jl_taggedvalue_t *o = jl_astaggedvalue(v);
if (!gc_marked(o)) {
// objprofile_count(jl_typeof(v), 1, 16);
#ifdef MEMDEBUG
gc_setmark_big(o, GC_MARKED_NOESC);
#else
gc_setmark_pool(o, GC_MARKED_NOESC);
#endif
}
// perm_scanned_bytes = s;
}
sizeof(int)=4
sizeof(void *)=8
sizeof(JL_DATA_TYPE)=0
sizeof(jl_value_t)=0
sizeof(jl_taggedvalue_t)=16
sizeof(jl_sym_t)=24
sizeof(jl_gensym_t)=8
sizeof(jl_tuple_t)=8
sizeof(jl_array_t)=40
sizeof(jl_lambda_info_t)=144
sizeof(jl_function_t)=24
sizeof(jl_typector_t)=16
sizeof(jl_typename_t)=32
sizeof(jl_uniontype_t)=8
sizeof(jl_fielddesc_t)=4
sizeof(jl_datatype_t)=88
sizeof(jl_tvar_t)=32
sizeof(jl_weakref_t)=8
sizeof(jl_binding_t)=40
sizeof(jl_module_t)=560
sizeof(jl_methlist_t)=48
sizeof(jl_methtable_t)=56
sizeof(jl_expr_t)=24
signal (11): Segmentation fault
unknown function (ip: -1395172488)
_ULppc64_is_signal_frame at /usr/lib/powerpc64le-linux-gnu/libunwind.so.8 (unknown line)
_ULppc64_step at /usr/lib/powerpc64le-linux-gnu/libunwind.so.8 (unknown line)
rec_backtrace_ctx at /gpfs/DDNgpfs1/geert/src/julia/src/task.c:655
rec_backtrace at /gpfs/DDNgpfs1/geert/src/julia/src/task.c:639
record_backtrace at /gpfs/DDNgpfs1/geert/src/julia/src/task.c:683
jl_vexceptionf at /gpfs/DDNgpfs1/geert/src/julia/src/builtins.c:61
jl_errorf at /gpfs/DDNgpfs1/geert/src/julia/src/builtins.c:68
jl_load_and_lookup at /gpfs/DDNgpfs1/geert/src/julia/src/ccall.cpp:119
blas_vendor at ./util.jl:115
unknown function (ip: -535265232)
unknown function (ip: 0)
/bin/sh: line 1: 72294 Segmentation fault /gpfs/DDNgpfs1/geert/src/julia/usr/bin/julia -C native --build /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys -J/gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/$([ -e /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys.ji ] && echo sys.ji || echo sys0.ji) -f sysimg.jl
geert@tulgbfen1:~/src/julia$ ./julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |
/ _` | |
| | |_| | | | (_| | | Version 0.4.0-dev+4185 (2015-04-08 06:47 UTC)
_/ |\__'_|_|_|\__'_| | Commit 9ad3aa0* (0 days old master)
|__/ | powerpc64le-linux-gnu
julia> Libdl.dllist()
signal (11): Segmentation fault
Segmentation fault
geert@tulgbfen1:~/src/julia$
geert@tulgbfen1:~/src/julia$ uname -a
Linux tulgbfen1 3.16.0-30-generic #40-Ubuntu SMP Mon Jan 12 22:07:11 UTC 2015 ppc64le ppc64le ppc64le GNU/Linux
geert@tulgbfen1:~/src/julia$ ./julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |
/ _` | |
| | |_| | | | (_| | | Version 0.4.0-dev+4187 (2015-04-08 19:01 UTC)
_/ |\__'_|_|_|\__'_| | Commit 961bc33* (0 days old master)
|__/ | powerpc64le-linux-gnu
julia> versioninfo()
Julia Version 0.4.0-dev+4187
Commit 961bc33* (2015-04-08 19:01 UTC)
Platform Info:
System: Linux (powerpc64le-linux-gnu)
CPU: unknown
WORD_SIZE: 64
BLAS: libblas
LAPACK: liblapack
LIBM: libm
LLVM: libLLVM-3.6.0
julia> f(x) = x*x
f (generic function with 1 method)
julia> code_native(f, (Int32,))
julia: codegen.cpp:1016: const jl_value_t* jl_dump_function_asm(void*): Assertion `fptr != 0' failed.
signal (6): Aborted
Aborted
LD_DEBUG=bindings ./julia
...
95608: binding file ./julia [0] to /gpfs/DDNgpfs1/geert/src/julia/usr/b
in/../lib/libjulia.so [0]: normal symbol `jl_compress_ast'
95608: ./julia: error: symbol lookup error: undefined symbol: jlcall_pr
int_44163 (fatal)
95608: ./julia: error: symbol lookup error: undefined symbol: julia_pri
nt_44163 (fatal)
95608: ./julia: error: symbol lookup error: undefined symbol: julia_sho
w_44940 (fatal)
95608: ./julia: error: symbol lookup error: undefined symbol: julia_dec
_44045 (fatal)
95608: ./julia: error: symbol lookup error: undefined symbol: julia_wri
te_sub_44050 (fatal)
...
95789: calling init: /gpfs/DDNgpfs1/geert/src/julia/usr/lib/julia/sys.s
o
95789:
95789: ./julia: error: symbol lookup error: undefined symbol: jlcall_pr
int_44163 (fatal)
95789: ./julia: error: symbol lookup error: undefined symbol: julia_pri
nt_44163 (fatal)
95789: ./julia: error: symbol lookup error: undefined symbol: julia_sho
w_44940 (fatal)
95789: ./julia: error: symbol lookup error: undefined symbol: julia_dec
_44045 (fatal)
95789: ./julia: error: symbol lookup error: undefined symbol: julia_wri
te_sub_44050 (fatal)
95789: ./julia: error: symbol lookup error: undefined symbol: julia_poi
nter_44052 (fatal)
95789: ./julia: error: symbol lookup error: undefined symbol: julia_wri
te_44055 (fatal)
mprotect(0x3ffda03f0000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda03d0000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda03b0000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda0390000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda0370000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda0350000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda0330000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda02f0000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda02e0000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda02c0000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda02a0000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda0270000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda0260000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda0240000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda0210000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda0200000, 65536, PROT_READ|PROT_EXEC) = 0
mprotect(0x3ffda01e0000, 65536, PROT_READ|PROT_EXEC) = 0
Julia is slower the first time it tries to execute something, while it tries to JIT compile optimized code. It gets much faster for me for subsequent characters.
Profiling julia (operf -g -- usr/bin/julia-debug -E "rand(10,10)*randn(10,10)"
) doesn’t seem to reveal any particular “smoking guns” (tested with llvm3.6):
CPU: ppc64 POWER8, speed 3425 MHz (estimated)
Counted CYCLES events (Cycles) with a unit mask of 0x00 (No unit mask) count 1500000
samples cum. samples % cum. % image name symbol name
1223 1223 2.5583 2.5583 libjulia-debug.so llvm::sys::Memory::InvalidateInstructionCache(void const*, unsigned lo
ng)
964 2187 2.0165 4.5748 libjulia-debug.so llvm::Value::getValueID() const
730 2917 1.5270 6.1019 libc-2.19.so malloc
712 3629 1.4894 7.5913 libc-2.19.so free
599 4228 1.2530 8.8443 libjulia-debug.so jl_egal
523 4751 1.0940 9.9383 libjulia-debug.so llvm::Type::getTypeID() const
512 5263 1.0710 11.0093 libjulia-debug.so type_eqv_
467 5730 0.9769 11.9862 libjulia-debug.so llvm::simplify_type<llvm::Value const* const>::getSimplifiedValue(llvm
::Value const* const&)
442 6172 0.9246 12.9108 libc-2.19.so _int_malloc
437 6609 0.9141 13.8249 libjulia-debug.so llvm::simplify_type<llvm::Value const*>::getSimplifiedValue(llvm::Valu
e const*&)
401 7010 0.8388 14.6637 libjulia-debug.so computeKnownBits(llvm::Value*, llvm::APInt&, llvm::APInt&, llvm::DataL
ayout const*, unsigned int, (anonymous namespace)::Query const&)
400 7410 0.8367 15.5005 libjulia-debug.so jl_method_table_assoc_exact
395 7805 0.8263 16.3267 libjulia-debug.so llvm::isa_impl_cl<llvm::Instruction, llvm::Value const*>::doit(llvm::V
alue const*)
369 8174 0.7719 17.0986 libjulia-debug.so llvm::isa_impl_wrap<llvm::Instruction, llvm::Value const* const, llvm:
:Value const*>::doit(llvm::Value const* const&)
361 8535 0.7552 17.8538 libjulia-debug.so jl_tupleref
352 8887 0.7363 18.5901 libjulia-debug.so llvm::Use::get() const
347 9234 0.7259 19.3160 libjulia-debug.so lookup_type
335 9569 0.7008 20.0167 libjulia-debug.so llvm::SmallPtrSetImplBase::insert_imp(void const*)
325 9894 0.6798 20.6966 libstdc++.so.6.0.19 /usr/lib/powerpc64le-linux-gnu/libstdc++.so.6.0.19
322 10216 0.6736 21.3701 libjulia-debug.so llvm::InstCombiner::DoOneIteration(llvm::Function&, unsigned int)
306 10522 0.6401 22.0102 libjulia-debug.so llvm::isa_impl<llvm::Instruction, llvm::Value, void>::doit(llvm::Value
const&)
294 10816 0.6150 22.6252 libjulia-debug.so cache_match
294 11110 0.6150 23.2402 libjulia-debug.so llvm::cast_convert_val<llvm::Instruction, llvm::Value const*, llvm::Va
lue const*>::doit(llvm::Value const* const&)
293 11403 0.6129 23.8532 libjulia-debug.so jl_tupleref
292 11695 0.6108 24.4640 libc-2.19.so __memset_power7
287 11982 0.6004 25.0643 libjulia-debug.so jl_is_type
284 12266 0.5941 25.6584 libjulia-debug.so jl_subtype_le
281 12547 0.5878 26.2462 libjulia-debug.so int64hash
268 12815 0.5606 26.8068 libjulia-debug.so llvm::PMDataManager::findAnalysisPass(void const*, bool)
267 13082 0.5585 27.3653 libjulia-debug.so jl_apply_generic
266 13348 0.5564 27.9218 libjulia-debug.so bool llvm::DenseMapBase<llvm::DenseMap<llvm::Instruction*, unsigned in
t, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, unsigned int> >, llvm::Instruction*, unsigned in
t, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, unsigned int> >::LookupBucketFor<llvm::Instructi
on*>(llvm::Instruction* const&, llvm::detail::DenseMapPair<llvm::Instruction*, unsigned int> const*&) const
254 13602 0.5313 28.4531 libjulia-debug.so llvm::isa_impl_wrap<llvm::Instruction, llvm::Value const*, llvm::Value
const*>::doit(llvm::Value const* const&)
The mprotect calls are needed to enable the eXecute bit on the pages. But there aren’t really that many calls, so they shouldn’t contribute much to the overall speed. (they barely show up in the profile, if at all).
Any idea why PPC64 ubuntu (as provided by https://www-304.ibm.com/partnerworld/wps/servlet/mem/ContentHandler/stg_com_sys_power-development-platform) is running with the kernel option CONFIG_PPC_64K_PAGES=y
? I’m not really sure of the effect of this kernel option on performance.
geert@tulgpu505:~/src/julia$ opreport
Using /home/geert/src/julia/oprofile_data/samples/ for samples directory.
CPU: ppc64 POWER8, speed 3923 MHz (estimated)
Counted CYCLES events (Cycles) with a unit mask of 0x00 (No unit mask) count 1500000
CYCLES:1500000|
samples| %|
------------------
17971 100.000 julia
CYCLES:1500000|
samples| %|
------------------
13884 77.2578 libLLVM-3.6.so
1794 9.9827 libjulia.so
1600 8.9032 libc-2.19.so
246 1.3689 no-vmlinux
225 1.2520 sys.so
205 1.1407 libstdc++.so.6.0.20
15 0.0835 ld-2.19.so
1 0.0056 anon (tgid:84195 range:0x3ffd92ae0000-0x3ffd92ccffff)
1 0.0056 libdl-2.19.so
geert@tulgpu505:~/src/julia$ opreport -a -l -s sample | more
Using /home/geert/src/julia/oprofile_data/samples/ for samples directory.
CPU: ppc64 POWER8, speed 3923 MHz (estimated)
Counted CYCLES events (Cycles) with a unit mask of 0x00 (No unit mask) count 150
0000
samples cum. samples % cum. % image name symbol name
1106 1106 6.1547 6.1547 libLLVM-3.6.so llvm::sys::Memory::InvalidateInstructionCache(void const*, unsigned long)
353 1459 1.9644 8.1191 libc-2.19.so malloc
342 1801 1.9032 10.0223 libc-2.19.so _int_free
264 2065 1.4691 11.4914 libLLVM-3.6.so computeKnownBits(llvm::Value*, llvm::APInt&, llvm::APInt&, llvm::DataLayout const*, unsigned int, (anonymous namespace)::Query const&)
246 2311 1.3689 12.8603 no-vmlinux /no-vmlinux
228 2539 1.2688 14.1291 libc-2.19.so _int_malloc
214 2753 1.1909 15.3200 libLLVM-3.6.so llvm::PassRegistry::getPassInfo(void const*) const
211 2964 1.1742 16.4942 libLLVM-3.6.so llvm::InstCombiner::DoOneIteration(llvm::Function&, unsigned int)
205 3169 1.1408 17.6349 libstdc++.so.6.0.20 /usr/lib/powerpc64le-linux-gnu/libstdc++.so.6.0.20
193 3362 1.0740 18.7090 libc-2.19.so __memset_power7
192 3554 1.0684 19.7774 libLLVM-3.6.so bool llvm::DenseMapBase<llvm::DenseMap<llvm::Instruction*, unsigned int, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, unsigned int> >, llvm::Instruction*, unsigned int, llvm::DenseMapInfo<llvm::Instruction*>, l
lvm::detail::DenseMapPair<llvm::Instruction*, unsigned int> >::LookupBucketFor<l
lvm::Instruction*>(llvm::Instruction* const&, llvm::detail::DenseMapPair<llvm::I
nstruction*, unsigned int> const*&) const
178 3732 0.9905 20.7679 libLLVM-3.6.so llvm::PMDataManager::findAnalysisPass(void const*, bool)
175 3907 0.9738 21.7418 libLLVM-3.6.so llvm::SmallPtrSetImplBase::insert_imp(void const*)
175 4082 0.9738 22.7156 libjulia.so jl_method_table_assoc_exact
167 4249 0.9293 23.6450 libjulia.so lookup_type
140 4389 0.7791 24.4240 libjulia.so jl_egal
137 4526 0.7624 25.1864 libjulia.so ios_getc
134 4660 0.7457 25.9321 libLLVM-3.6.so llvm::PMTopLevelManager::findAnalysisPassInfo(void const*) const
132 4792 0.7346 26.6667 libc-2.19.so __strncmp_power7
117 4909 0.6511 27.3178 libc-2.19.so __memcmp_power7
116 5025 0.6455 27.9633 libLLVM-3.6.so llvm::TargetLibraryInfo::getLibFunc(llvm::StringRef, llvm::LibFunc::Func&) const
107 5132 0.5954 28.5587 libjulia.so jl_deserialize_value_
104 5236 0.5787 29.1375 libLLVM-3.6.so llvm::PMTopLevelManager::findAnalysisPass(void const*)
103 5339 0.5732 29.7106 libLLVM-3.6.so llvm::DataLayout::getTypeSizeInBits(llvm::Type*) const
100 5439 0.5565 30.2671 libLLVM-3.6.so llvm::Value::stripPointerCasts()