Julia: using shell command within repl is very slow, even though very simple command such as ls, pwd

Created on 8 Jul 2016  Â·  20Comments  Â·  Source: JuliaLang/julia

Most helpful comment

Ok, I'm not sure what, if any action should be taken on the Julia side. We could try to keep a shell process going in the background – that seems to be what IPython does.

All 20 comments

versioninfo()

Julia Version 0.4.6
Platform Info:
System: Linux (x86_64-redhat-linux)
CPU: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
WORD_SIZE: 64
BLAS: libmkl_rt
LAPACK: libmkl_rt
LIBM: libimf
LLVM: libLLVM-3.3

This needs more information to diagnose. Are you running in the cloud? Is your hard disk really slow?

I run on a Linux cluster. Running shell command within ipython is very fast. How to offer more information?

Is the filesystem NFS / other distributed fs? What are the commands you're running. Can you do something like this to demonstrate the slowness?

julia> @time run(`ls -l`)
total 272
-rw-r--r--   1 stefan staff 18386 Jul 11 15:51 CONTRIBUTING.md
-rw-r--r--   1 stefan staff   164 Jul 18 18:35 DEBUGGER.md
-rw-r--r--   1 stefan staff  8487 Jul 18 18:35 DISTRIBUTING.md
-rw-r--r--   1 stefan staff 75525 Jun 21 17:25 HISTORY.md
-rw-r--r--   1 stefan staff  5239 Jul 18 18:35 LICENSE.md
-rw-r--r--   1 stefan staff 32358 Jul 18 18:35 Make.inc
-rw-r--r--   1 stefan staff 27803 Jul 18 18:35 Makefile
-rw-r--r--   1 stefan staff 16463 Jul 18 18:35 NEWS.md
-rw-r--r--   1 stefan staff  4411 Jun 21 17:25 README.arm.md
-rw-r--r--   1 stefan staff 28004 Jul 18 18:35 README.md
-rw-r--r--   1 stefan staff 18012 Jul 18 18:35 README.windows.md
-rw-r--r--   1 stefan staff    10 Jun 21 17:25 VERSION
-rw-r--r--   1 stefan staff  1534 Feb 22 19:02 Windows.inc
-rw-r--r--   1 stefan staff  2174 Jul 18 18:35 appveyor.yml
drwxr-xr-x 162 stefan staff  5508 Jul 18 18:38 base
drwxr-xr-x  34 stefan staff  1156 Jul 18 18:35 contrib
drwxr-xr-x  44 stefan staff  1496 Jul 18 18:35 deps
drwxr-xr-x  19 stefan staff   646 Jul 18 18:35 doc
drwxr-xr-x   3 stefan staff   102 Feb 22 19:02 etc
drwxr-xr-x  18 stefan staff   612 Jun 21 17:25 examples
lrwxr-xr-x   1 stefan staff    13 Jul 18 18:38 julia -> usr/bin/julia
drwxr-xr-x 136 stefan staff  4624 Jul 18 18:38 src
drwxr-xr-x 126 stefan staff  4284 Jul 18 18:35 test
drwxr-xr-x  51 stefan staff  1734 May 14 15:01 tmp
drwxr-xr-x   6 stefan staff   204 Jul 18 18:38 ui
drwxr-xr-x  10 stefan staff   340 Jun 30 17:31 usr
drwxr-xr-x  28 stefan staff   952 Jul 18 18:38 usr-staging
  0.024555 seconds (33 allocations: 1.453 KB)

The command @time run(ls -l) is not slow, but using ; then ls -al is very slow.

If you want help on this issue, you're going to need to produce actual timings and outputs, not just vague descriptions of what you feel like you're seeing. Information like the output of the mount command for your cluster is also necessary since this sounds like a standard NFS slowness issue, which would be unrelated to Julia. Are you running the exact same commands in the same directory in Julia and Python? If so, please provide transcripts of each with timings.

Sorry, I can't access to the Internet in my computer now. I will give the actual information when I have Internet.

@StefanKarpinski I don't know how to produce actual timings within shell mode, so I recorded a [video].(https://drive.google.com/open?id=0B7DapXLbWsRKMzh6bWxvbUJBNjQ)

This seems to be due to gpfs being slow. The question is why the slowness affects Julia's shell mode and not IPython's or bash itself, which leads me to believe that it may be spawning the shell command that is slow. The bash process is persistent and doesn't have to fork all the time; I'm not sure what IPython does, but it may start a single shell process and keep it running. You may have shell rc files that take a while to run – and are being run every time you run a command. I'm not sure what the best way to test that out is, but what are your bash rc files doing?

I'm not sure what the best way to test that out is,

Timing bash -c ls or bash -ic ls?

Looks like you might be using zsh so zsh -c ls and zsh -ic ls instead.

Yeah, timing those would be a good start.

image
image
image

It looks like for some reason running zsh in interactive mode (-i) takes a really long time.

But another computer using zsh and the same zshrc don't have this problem.

Julia Version 0.4.5
Commit 2ac304d (2016-03-18 00:58 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

Maybe you can experiment taking away stuff from .zshrc and see what is slow.

Just to spell this out: in interactive mode and only in interactive mode, zsh runs /etc/zshrc and ~/.zshrc – somethign in there is likely slow on this machine. Why is it slow on this system and not any other? Because this system has a distributed file system which can make otherwise harmless operations very, very slow. So you're looking for something that's done in a zshrc file that hits the file system somehow.

I remove all stuff in .zshrc, it becomes very fast like IPython. Thank you for your attention to this matter.

Ok, I'm not sure what, if any action should be taken on the Julia side. We could try to keep a shell process going in the background – that seems to be what IPython does.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wilburtownsend picture wilburtownsend  Â·  3Comments

dpsanders picture dpsanders  Â·  3Comments

m-j-w picture m-j-w  Â·  3Comments

i-apellaniz picture i-apellaniz  Â·  3Comments

tkoolen picture tkoolen  Â·  3Comments