Writing Rust libraries for the Python scientific computing ecosystem

One of Rust's many strengths is that it can be seamlessly integrated with Python and speed up critical code sections. I recently wrote a small library with an efficient ragged array datatype, and I figured it would make for a good example of how to set up a Rust Python package with PyO3 and maturin that interoperates with numpy. There are a lot of little details that took me quite a while to figure out:

  • Publishing to PyPI:
  • Exporting MyPy type annotations:
    • In most cases, you will only need a type stubs file placed in the root project directory, in which case the name of the file should be the same as the package name
    • Since this is a mixed Python/Rust project, you also need to place a py.typed marker file in the Python module
    • There is some extra Python code to export a generic version of the RaggedBuffer datatype (generics are not supported by PyO3)
  • Integration with numpy uses the rust-numpy crate:
    • Example of method tha
... keep reading on reddit ➑

πŸ‘︎ 185
πŸ’¬︎
πŸ‘€︎ u/Programmierer
πŸ“…︎ Dec 19 2021
🚨︎ report
How much potential is there for pay-as-you-go serverless scientific computing?

Examples of serverless computing are Amazon Lambda, Google Cloud Functions and Azure Serverless.

Scientific computing are conducted by researchers and engineers. A headache of scientific computing is each full scale iteration before the researcher can view the result takes long CPU hours, making testing and debugging only feasible in smaller surrogate scales.

Thus, more and more researchers are using serverless clouds to dynamically summon a high surge of computational power and release them when the full-scale iteration finish running.

For computation tasks without sensitive data or code, such as protein folding and public domain data crunching, there is BOINC and Gridcoin to facilitate distributed scientific computing and allow anyone to donate or sell computation power for Gridcoin, but BOINC's programming interface is not as easy to use as Amazon and Google's. In addition, BOINC requires manual approval of projects, because BOINC agent is not containerized/virtualized, computing code could present malware threat to host.

I wish to create an alternative to BOINC/Gridcoin, using container/VM images as computation tasks, and support unmonitored pay-as-you-go serverless computing.

I want to know if there is a large enough market for it.

Think this way, the world mines 6 bitcoins/day (US$42K/day, or US$15.3 million/year). Do all "embarrassingly parallel" scientific computing projects combined have comparable annual revenue with BTC or a lesser cryptocurrency such as ETH or DOGE?

πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/larryliu7
πŸ“…︎ Jan 11 2022
🚨︎ report
FOSE1025 Scientific Computing

Has anyone done this unit and what was your experience like? The unit guide isn’t very helpful on what type of assessment and activities it includes.

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/xlsk
πŸ“…︎ Jan 05 2022
🚨︎ report
How much potential is there for pay-as-you-go serverless scientific computing? /r/gridcoin/comments/s14d…
πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/larryliu7
πŸ“…︎ Jan 11 2022
🚨︎ report
Help building a workstation for scientific computing?

>What will you be doing with this PC? Be as specific as possible, and include specific games or programs you will be using.

  • I will primarily be running numerical linear algebra/large-scale optimization codes. Many of these applications have big matrices (say 100k by 10k at least, but in some cases, the dimensions can be in the millions, this is rarer) and they could be quite dense (although some applications also have sparse linear algebra). The bottle neck in most of these applications is loading large matrices into memory, and multiplying them and or solving relatively large, and possibly dense, systems of equations. Will need OS = Linux distro, ideally Debian based.

>What is your maximum budget before rebates/shipping/taxes?

  • I am open on this, but ideally at most 2k. If we can get significantly better performance by spending 5k that could be ok too. (Would like to understand *how* much better the performance would be at this price point.)

>When do you plan on building/buying the PC? Note: beyond a week or two from today means any build you receive will be out of date when you want to buy.

  • Within the next two weeks.

>What, exactly, do you need included in the budget? (Tower/OS/monitor/keyboard/mouse/etc)

  • I do not need peripherals (keyboard, mouse) and do not need a monitor (already have these). Everything else will be needed.

>Which country (and state/province) will you be purchasing the parts in? If you're in US, do you have access to a Microcenter location?

>If reusing any parts (including monitor(s)/keyboard/mouse/etc), what parts will you be reusing? Brands and models are appreciated.

>Will you be overclocking? If yes, are you interested in overclocking right away, or down the line? CPU and/or GPU?

  • I am not sure; no plans currently for this.

>Are there any specific features or items you want/need in the build? (ex: SSD, large amount of storage or a RAID setup, CUDA or OpenCL support, etc)

  • I would imagine a large amount of RAM and high core count per socket would be important. I am not a HPC/sc
... keep reading on reddit ➑

πŸ‘︎ 4
πŸ’¬︎
πŸ“…︎ Dec 16 2021
🚨︎ report
What is a relatively "unpopular" programming language that you use for scientific computing? What do you use it for?

There seems to be a conventional or "accepted" list of programming languages suitable for scientific/numerical computing that everyone tends to stick to. These include Python, Fortran, R, C/C++, Matlab, and more recently, Julia. I suppose Java might also be up there though I don't know as many groups that use it (and I apologize if I'm forgetting another major one -- does Mathematica count?). I've also heard Rust is rapidly gaining in popularity, although I don't know if this effect has spilled over to the scientific community.

I'm curious about any less conventional (in terms of sci computing) languages that people in the physical sciences may be using. I've heard Haskell mentioned once or twice, although I'm not sure what it is used for; and I know there are a few companies that use Lisp for Quantum Computing.

Do you use any language outside the conventional list of what people tend to use? If yes, what do you use them for?

EDIT: Some great answers. A lot of of people have mentioned Domain Specific languages designed for scientific/numerical computing. That's not exactly what I meant -- I wouldn't consider such languages "unconventional" or "unpopular" for the purposes of scientific computing since they were designed just for that purpose. Still, it's nice to hear what everyone is using!

πŸ‘︎ 97
πŸ’¬︎
πŸ‘€︎ u/jmhimara
πŸ“…︎ Sep 12 2021
🚨︎ report
(book) OCaml Scientific Computing ocaml.xyz/book/
πŸ‘︎ 49
πŸ’¬︎
πŸ‘€︎ u/indraniel
πŸ“…︎ Nov 10 2021
🚨︎ report
Does anyone in this community know any scientific computing focused software companies in India?

Basically, the title. I am currently working as a scientific software developer for a tiny company in a Bangalore. But, I am always looking for newer opportunities for the future. Hence, I am asking here.

πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/loukitkhemka
πŸ“…︎ Nov 21 2021
🚨︎ report
Trying to decide between Google’s Python Crash Course or FreeCodeCamp’s Scientific Computing with Python Course. Suggestions?

I have no previous experience coding. Goal is to learn to scrap real estate related info from websites.

https://www.coursera.org/learn/python-crash-course

https://www.freecodecamp.org/learn/scientific-computing-with-python/

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/BronxLens
πŸ“…︎ Dec 26 2021
🚨︎ report
Anybody tested scientific computing (python especially) performance of the new macs?

I’ve a 16 inch 2019 model and on the fence about getting an M1 max mbp. People who got them, did you check how’s performance of python libraries like numpy, scipy, pytorch in general?

Most YouTube benchmarks are from video editors or creative pros so any info from people using these machines for compute tasks would be helpful.

Also if you’re a software dev, care to share your experience so far?

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/shawon-ashraf-93
πŸ“…︎ Oct 28 2021
🚨︎ report
Build advice: Scientific Computing rig

Looking at putting together a rig that would perform coarse grain molecular simulations at a decent rate. These simulations run ~250,000,000 steps and can reach quite a size. I have access to High Performance Computing however with strict time limits in place it can be tough to have a long running work flow.

My budget sits in the Β£1500-Β£2000 range. I’m aware that this won’t get me anywhere near the levels of a HPC centre but this is more of a let it sit and run on side projects.

Upgradability is a key factor as when finances allow I can move up the spec as required.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/KrellBonk
πŸ“…︎ Nov 25 2021
🚨︎ report
Laptop for scientific computing/machine learning research
  • Total budget (in local currency) and country of purchase. Please do not use USD unless purchasing in the US:

Somewhere between Β£800-1200 (UK) (willing to go a bit higher for something really good)

  • Are you open to refurbs/used?

Yes, would very much appreciate a good value used ThinkPad for example

  • How would you prioritize form factor (ultrabook, 2-in-1, etc.), build quality, performance, and battery life?

Performance by far, then battery then build. Don't care if the form factor is a little on the larger side.

  • How important is weight and thinness to you?

Less important (as long as its not huge)

  • Do you have a preferred screen size? If indifferent, put N/A.

Ideally at least 14", don't really care though

  • Are you doing any CAD/video editing/photo editing/gaming? List which programs/games you desire to run.

Heavy numerical computing, particularly quite RAM heavy. Ideally, at least 16GB RAM (with the ability to upgrade eventually to 32GB+). GPU isn't necessary, but the ability to use an eGPU (for deep learning mainly rather than gaming) would also be desirable.

  • If you're gaming, do you have certain games you want to play? At what settings and FPS do you want?

Don't care about gaming

  • Any specific requirements such as good keyboard, reliable build quality, touch-screen, finger-print reader, optical drive or good input devices (keyboard/touchpad)?

Decent keyboard

  • Leave any finishing thoughts here that you may feel are necessary and beneficial to the discussion.

I do like thinkpads in general, so a suggestion for a new/used model would be much appreciated. I'm also open to any other suggestions you think would fit my use. Also - it seems like Ryzen processors have much better performance per price in general. If I don't care as much about battery life, should I always prefer Ryzen?

Thanks in advance for the suggestions!

EDIT: also - I'll be running Linux

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/stihlboy
πŸ“…︎ Dec 08 2021
🚨︎ report
In your opinion, what functional programming language is most suitable for scientific / numerical computing?

The answer must take into account both the capabilities of the language (e.g. performance, ease-of-use, efficient ffi, parallelism, GC, etc...) as well as available ecosystem (i.e. developing tools and existing numerical/scientific libraries).

So far I've explored a few like Haskell, OCaml, and various Lisps like Common Lisp and Racket. I was not a fan of Haskell and there doesn't seem to be much in the way of numerical libraries. On the other hand, I quite liked OCaml and despite the relatively small community of users, there seems to be quite a decent amount of scientific libraries for it (e.g. the excellent Owl project). I have not tried anything parallel yet with OCaml, but there seems to be a consensus that the language is not great in that regard. I was also impressed by the near-C speeds that Common Lisp can offer, but at the same time I didn't like the language that much. I found Scheme (e.g. Racket) a lot nicer to work with, but again, the ecosystem of scientific libraries is relatively poor (I think that's true for all Lisps).

I'm looking forward to reading everyone's opinion on the subject.

πŸ‘︎ 23
πŸ’¬︎
πŸ‘€︎ u/jmhimara
πŸ“…︎ Oct 05 2021
🚨︎ report
Google’s β€˜time crystals’ could be the greatest scientific achievement of our lifetimes: Alleged development of a new, Newtonian physics breaking, phase of matter could be the key to unlocking the full potential of quantum computing. thenextweb.com/news/googl…
πŸ‘︎ 299
πŸ’¬︎
πŸ“…︎ Aug 02 2021
🚨︎ report
Amazon SageMaker Studio Lab - Quickly create data analytics, scientific computing, and machine learning projects with notebooks in your browser. studiolab.sagemaker.aws/
πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/ckilborn
πŸ“…︎ Dec 02 2021
🚨︎ report
Roblox for scientific computing/how to discretize a mesh for numerical PDE solving?

Hello all, I’ve been playing around with finite difference numerical method schemes. My goal is to take a mesh into Roblox and and and solve a finite difference form of the heat equation on each of it’s parts, then assign a color to each part based on the temperature calculated from the heat equation solved on said part.

I have the actual finite difference solver down, however it’s the part about discretizing a mesh which I’m struggling with. Are there any resources or insights any of you have that can point me in the right direction?

Edit: I am well aware this is not what Roblox was designed for, it’s just a cool little experiment I’m running.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/MonsieurDArtagnan
πŸ“…︎ Nov 09 2021
🚨︎ report
Suggest me a Good library for scientific computing in Julia with good support for multi-core CPUs and GPUs.

Basically, I am looking for some library to write my own PDE solver in Julia with easy integration of multiple core and GPU support.

Also, how good the support is for PETSc in Julia? I know there are wrappers, but can I use them with Julia Datatypes or only with PETSc datatypes?

πŸ‘︎ 18
πŸ’¬︎
πŸ‘€︎ u/loukitkhemka
πŸ“…︎ Sep 18 2021
🚨︎ report
Anyone got letter of acceptance from MSc Scientific Computing

It's been quite some time since I've applied for scientific computing. I've not heard anything back, and in the website it still says it is being processed. Is there anyone who got accepted or rejected?

πŸ‘︎ 5
πŸ’¬︎
πŸ“…︎ Sep 10 2021
🚨︎ report
OCaml Scientific Computing ocaml.xyz/book/
πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/indraniel
πŸ“…︎ Nov 10 2021
🚨︎ report
C/C++ for Java dev with plan to get into scientific computing

Hi, I have bachelors in Aerospace Eng and about to get one in Comp Sci, I program usual corporate Java daily (junior level, hopefully graduating to mid in coming months), know some MATLAB and basic Python (and even more basic C). Spring and other libraries handle everything nicely so I never had to properly learn parallel programming both in Java and in other languages. I'd like to learn solid understanding of parallel programming in the OG languages to both have better perspective in Java but mostly to be able to write some fast engineering and scientific code, and possibly get into CUDA one day.

Beginner courses are excrutatingly boring and flooded with crappy content, but when I tried to read an introductory HPC book, I spent a long time fighting problems I couldn't understand which were assumed to be known. "C for Java developers"-like videos I found also feel bloated.

Do you know a book or course that cuts through the crap?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/rafalsz
πŸ“…︎ Nov 14 2021
🚨︎ report
PC for scientific computing

Budget: $4,000 (CAD)

PC purpose: It will be used exclusively for scientific computing. The program that we will use the most requires 4 GB per thread. Also, the developer's website says "There is no upper limit on the number of cores. Whatever you can fit into a shared memory machine will work as long as the disk performance scales up with it". This is as far as the description goes, so I am afraid it is not a linear scale of performance vs number of cores. For this reason, we are probably going for a Ryzen instead of Threadripper. Also, I heard from other people that writing speeds are important, so I want to pick a very good SSD PCI-E gen 4 for the primary slot.

Other details:

Detail 1: I build it using a small form factor to save some space on the bench. If you think this can be harmful in the long term, please, let me know and I will change for full ATX.

Detail 2: It is based on product availability at a Memory Express store located in our city.

This is the build I put together:

PCPartPicker Part List

CPU: AMD Ryzen 9 5950X 3.4 GHz 16-Core Processor ($870.95 @ shopRBC)
CPU Cooler: Noctua NH-U14S 82.52 CFM CPU Cooler ($98.28 @ Amazon Canada)
Motherboard: MSI MAG B550M MORTAR WIFI Micro ATX AM4 Motherboard ($189.00 @ Amazon Canada)
Memory: G.Skill Ripjaws V 128 GB (4 x 32 GB) DDR4-3200 CL16 Memory ($784.99 @ Memory Express)
Storage: Western Digital Blue SN550 1 TB M.2-2280 NVME Solid State Drive ($109.99 @ Newegg Canada)
Storage: Samsung 980 Pro 1 TB M.2-2280 NVME Solid State Drive ($287.99 @ PC-Canada)
Video Card: Asus GeForce GT 1030 2 GB Video Card ($118.80 @ Vuugo)
Case: [Fractal Design Focus G Mini M

... keep reading on reddit ➑

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/gustavofw
πŸ“…︎ Oct 13 2021
🚨︎ report
Help For Scientific Computing M.Sc.

This program has a lot of heavily theoretical maths and some little applied math and coding classes.

I don't know if this is enough to find a job as a machine learning engineer or a data analyst. What do you think about the curriculum of this program and do you think it is enough to find a job in machine learning?

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/erenozata
πŸ“…︎ Aug 14 2021
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.