Live data from Hacker News

Advanced computing with IPython

lwn.net

101–108 of 108 posts

Re: Advanced computing with IPython

#101
post #10

At Harvard we've built out an infrastructure to allow us to deploy JupyterHub to courses with authentication managed by Canvas. It has allowed us to easily deploy complex set-ups to students so they can do really cool stuff without having to spend hours walking them through setup. Instructors are writing their lectures as IPython notebooks, and distributing them to students, who then work through them in their Jupyte…

I saw your repo a few months ago when looking at implementing something similar! A lot of the things in the development notes seem to have been solved or improved recently.

I do think that Jupyter notebooks are an amazing thing for CS Education. I wish more college level classes would utilize them. It adds a nice layer of interactive experimentation to any program/assignment/project.

What I ended up using was z2jh [0], which is working out great for right now!

We aren't yet allowing students to use GPUs or any libs that would require them, but we may look into that in the future.

[0]: https://github.com/jupyterhub/zero-to-jupyterhub-k8s

Re: Advanced computing with IPython

#103

Earlier quoted context omitted.

This is how I work as well, where all the code I'm working with in a jupyter notebook is directly visible on my screen. Any other code is generally 'finished' and put into a text editor. Additionally, I use the following settings in my ipython_config.py file to automatically reload modules: c.InteractiveShellApp.extensions = [ 'autoreload' ] c.InteractiveShellApp.exec_lines [ '%autoreload 2' ]

Note that the autoreload features can be very tricky to use safely with Python. For example, at least in some previous versions, Caffe and TensorFlow make incompatible assumptions about the ability to claim all available GPU memory. So there can be situations where you first import Caffe, then later import TensorFlow with restrictions on its GPU policy. If you naively re-import the Caffe code, it can evict TensorFlow…

Thanks for explaining the downsides related to using this feature. Like all good config options, there are tradeoffs. Luckily I haven't been bitten by it yet, but I'll remember that if I run into issues

Re: Advanced computing with IPython

#104

Earlier quoted context omitted.

I'm so glad my college had class sizes of 10-15 and not 100, what a waste of money.

> what a waste of money. Uh, you know its Harvard we're talking about right?

Yes, especially because it's Harvard. It should be better than that given its cost and endowment.

Re: Advanced computing with IPython

#105
post #71

Earlier quoted context omitted.

This is an extremely limited view of "scientific computing" that seems to only focus on analytics, which is a tiiiny part of sci comp. Your "stack" does nothing for solving/including ODEs, PDEs, DAEs, Fourier analysis, numerical integration, automatic differentiation, linear equation system solvers, preconditioners, nonlinear equation system solvers, the entire field of optimization, inverse problems, statistical met…

I completely agree that there are many scientific libraries in python which scale up. I was addressing the article which showed a more advanced way to use python with the purpose of making it applicable to large datasets. If you were to implement a method from scratch or scale up to a larger dataset then you'll end up with using numba, numpy and dask. This is completely from a lower level programming perspective to i…

I have yet to see a situation where Numba makes real sense, as compared to just dropping down into C(++) or Fortran when you need to do the heavy lifting. Can you give me a good example?

Re: Advanced computing with IPython

#106

Deep research uses aside, I often prefer to use IPython because it's simply a better shell than the default Python shell. You get basic niceties like tab completion and being able to up-arrow to revise an earlier multi-line command (like a function) without it being an exercise in frustration.

Indeed. If I could only figure out how to have it automatically run `from math import *` (and then present me with the interactive shell, I could use it as a calculator too.

Try this shell script:

    #! /bin/sh
    # This is a bit hacky: we use the -i flag to force the interpreter into 
    # interactive mode after the initial commands are executed.
    # The "proper" way to do this is probably to set up a PYTHONSTARTUP file
    # and put the initial commands in there.
    exec ipython3 --no-banner --no-confirm-exit -i -c '
    from math import *
    import random
    import sys, os, platform
    print("== IPython %s Calculator REPL ==" % platform.python_version())
    '

Re: Advanced computing with IPython

#107

For the last couple of year I had wrongly thought that IPython was short for Iron Python. Now that I know it is not, I understand the hype around it more

Early in my career I thought CPython and Cython were the same. And then Pypy and Pypi confused me. And Python the language vs. Python the implementations and how when someone says "Python" in some contexts they assume "CPython". Landmines everywhere!

Well there's another two I thought meant the same thing. Thanks for the lesson!

Re: Advanced computing with IPython

#108

Earlier quoted context omitted.

Indeed. If I could only figure out how to have it automatically run `from math import *` (and then present me with the interactive shell, I could use it as a calculator too.

Try this shell script: #! /bin/sh # This is a bit hacky: we use the -i flag to force the interpreter into # interactive mode after the initial commands are executed. # The "proper" way to do this is probably to set up a PYTHONSTARTUP file # and put the initial commands in there. exec ipython3 --no-banner --no-confirm-exit -i -c ' from math import * import random import sys, os, platform print("== IPython %s Calculato…

Thank you for the suggestion! I still get the error, unfortunately:

      File "", line 1
        from
            ^
    SyntaxError: invalid syntax
I shall see if it starts working when I upgrade to a distro with a newer IPython.
Post reply on HN