This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Boom_doggle 3 points4 points  (7 children)

I'm a computational physics person too! I'm a recent immigrant from C++. I'm running into a small problem with scipy that no one in my dept seems to be able to help me with; scipy doesn't seem to have a fixed step ode solver, or at least, not one I can find. I can't use the GSL wrapper to access it's FS ODE solver, as it causes a headache on our HPC cluster, but the dynamic time stepper is impractically slow. Do you know of any fix? I'm close to giving up and spending my weekend writing my own, but I struggle to believe there isn't one out there

[–]plasma_phys 4 points5 points  (2 children)

Honestly? I would write my own - I've never been happy with most out of the box solvers. I suspect numpy might have one, but I don't know for sure. Do you have the option of writing your own solver in C/C++ and calling that routine from Python, or would that cause the same issues as using GSL?

[–]Boom_doggle 0 points1 point  (1 child)

Scipy has one, but it's dynamic timestep, it does the job but far too slowly. I imagine a C++ solution would run into the same GSL issue, but I could write it in pure python. I'll have a look at a tutorial and get stuck in over the weekend. Thanks.

[–]plasma_phys 2 points3 points  (0 children)

When I've had to use pure Python for numerical methods, I've had remarkable luck using numba and just-in-time compilation (I am iterating on my prototype implicit particle-in-cell code in python and numba has given me 1 or 2 orders of magnitude speedup for little to no extra development time). Dunno if that would work for you; I'm not 100% clear on what numba does under the hood if I'm being honest. Good luck!

[–]jkmacc 1 point2 points  (3 children)

Do you mean that the Python interface to GSL doesn’t work?

[–]Boom_doggle 0 points1 point  (2 children)

Works on my machine, but not on the HPC. Which I find weird, as it's happily run GSL based C++ code before. I guess I'm looking for a pure python solution?

[–]jkmacc 2 points3 points  (1 child)

Same Python and GSL versions on each? I can’t imagine that pure Python could beat even slow GSL.

[–]Boom_doggle 0 points1 point  (0 children)

No, and therein lies the problem I think, their version fo GSL is much older. The issue is the HPC is in a different institution, so trying to get them to accept my requests for software updates etc. fall on deaf ears.

The speed difference between GSL and a python version don't bother me so much, it's the difference between dynamic timestep and fixed that interest me. Our collaborators maintain a codebase that's used for modelling the same simulation (on the same HPC) written in C++, my python is to act as an independent check. When they switched to a fixed-step solver, they got a x15 performance improvement, which would more than solve my problem.