Mind-bending new programming language for GPUs just dropped...
Skills:
AI Pair Programming53%
Key Takeaways
This video introduces the Bend programming language for parallel computing on GPUs with a Python-like syntax
Full Transcript
yesterday the clouds opened up and a weird new programming language came down to earth with a promise of parallelism for allou who writeth code this is big if true because parallel Computing is a superpower it allows a programmer to take a problem that could be solved in a week and instead solve it in seven days using seven different computers unfortunately running code in parallel is like conducting a symphony one wrong note and the entire thing becomes a total disaster but luckily Bend offers Hope by making a bold promise everything that can run in parallel will run in parallel you don't need to know anything about Cuda blocks locks mutexes or regex's to write algorithms that take advantage of all 24 of your CPU cores or even all 16,000 of your GPU cores you just write some highlevel python looking code and the rest is Magic it is May 17th 2024 and you're watching the code report when you write code in a language like python your code runs on a single thread that means only one thing can happen at a time it's like going to a KFC with only one employee who takes the order cleans the toilets and Cooks the food in that order now on a modern CPU you might have a clock cycle around 4 GHz and if it's handling one instruction per cycle you're only able to perform 4 billion instructions per second now if four giips is not enough you can modify your python code to take advantage of multiple threads but it adds a lot of complexity to your code and there's all kinds of gotas like race conditions Deadlocks thread starvation and may even lead to conflicts with demons even if you do manage to get it working you might find that your CPU just doesn't have enough juice at which point you look into using the thousands of cacor on your GPU you but now you'll need to write some C++ code and likely blow your leg off in the process well what if there is a language that just knew how to run things in parallel by default that's the promise of Bend imagine we have a computation that adds two completely random numbers together in Python The Interpreter is going to convert this into B code and then eventually run it on the python virtual machine pretty simple but in Bend things are a little more complex the elements of the computation are structured into a graph which are called interaction combinators you can think of it as a big network of all the computations that need to be done when two nodes run into each other the computation progresses by following a simple set of rules that rewrite the computation in a way that can be done in parallel it continues this pattern until all computations are done it then merges the result back into whatever expression was returned from the function this concept of interaction combinators goes all the way back to the 1990s and is implemented in a runtime called the higher order virtual machine hbm is not meant to be used directly and that's why they build bend a highle language to interface with it and the language itself is implemented in Rust its syntax is very similar to Python and we can write a Hello World by defining a main function that returns a string now to execute this code we can pull up the terminal and use the Ben run command by default this is going to use the rust interpreter which will execute it sequentially just like any other boring language but now here's where things get interesting imagine we have an algorithm that needs to count a bunch of numbers and then add them together the first thing that might blow your mind is that bend does not have loops like we can't just do a for Loop like we would in Python instead Bend has something entirely different called a fold that works like a search and replace for data types and any algorithm that requires a loop can be replaced with a fold basically a fold allows you to consume recursive data types in parallel like a list or a tree but first we need to construct a recursive data type and for that we have the bend keyword which is like the opposite of fold now if that's a little too mind-bending maybe check out my back catalog for recursion in 100 seconds but now let's see what this looks like from a performance standpoint when I try to run this algorithm on a single thread it takes forever like 10 minutes or more however I can run the same code without any modification whatsoever with the bend run C command when I do that it's now utilizing all 24 threads on my CPU and now it only takes about 30 seconds to run the computation that's a huge Improvement but I think we can still do better because I'm a baller I have an Nvidia RTX 490 and once again I can run this code without any modification on Cuda with Bend run- cuu and now this code only takes 1 and 1 half seconds to run and I'll just go ahead and drop the mic right there this has been the code report thanks for watching and I will see you in the next one
Original Description
What is the Bend programming language for parallel computing? Let's take a first look at Bend and how it uses a Python-like syntax to write high performance code that can run on the GPU.
#programming #tech #thecodereport
💬 Chat with Me on Discord
https://discord.gg/fireship
🔗 Resources
Bend Language GitHub https://github.com/HigherOrderCO/Bend
CUDA in 100 Seconds https://youtu.be/pPStdjuYzSI
Recursion in 100 Seconds https://youtu.be/rf60MejMz3E
🔥 Get More Content - Upgrade to PRO
Upgrade at https://fireship.io/pro
Use code YT25 for 25% off PRO access
🎨 My Editor Settings
- Atom One Dark
- vscode-icons
- Fira Code Font
🔖 Topics Covered
- What is Bend language?
- Parallelism vs Concurrency
- Rust programming language projects
- CUDA alternatives
- How to run code on a GPU
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Fireship · Fireship · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Angular 4 Development and Production Environments with Firebase
Fireship
OAuth with Angular and Firebase Tutorial
Fireship
Anonymous Authentication with Angular and Firebase - Lazy Registration
Fireship
Angular Router Guards for Firebase Users
Fireship
Angular Firebase CRUD App with NoSQL Database Tutorial
Fireship
Upload Files from Angular to Firebase Storage
Fireship
How to Deploy an Angular App to Firebase Hosting
Fireship
Sharing Data between Components in Angular
Fireship
Loading Spinners for Asynchronous Firebase Data
Fireship
Angular 4 Transactional Email with Google Firebase Cloud Functions
Fireship
Firebase Database Rules Tutorial
Fireship
Autocomplete Search with Angular4 and Firebase
Fireship
Reddit Inspired Upvoting System with Angular and Firebase NoSQL
Fireship
Angular Drag-and-Drop File Uploads to Firebase Storage
Fireship
Text Translation with Firebase Cloud Functions onWrite and Angular 4
Fireship
Custom Usernames with Firebase Authentication
Fireship
Twitter-Inspired Follow Unfollow Feature with Firebase and Angular 4
Fireship
Simple Pagination with Firebase and Angular 4
Fireship
How to Connect Firebase Users to their Data - 3 Methods
Fireship
Add Toast Message Notifications to your Angular App
Fireship
Facebook-Inspired Reactions System with Angular and Firebase
Fireship
Learn NgModule in Angular with Examples
Fireship
Lazy Loading Components in Angular 4
Fireship
Stripe Checkout Payments with Angular and Firebase - Part 1
Fireship
Process Stripe Payments with Firebase Cloud Functions - Part 2
Fireship
Selling Digital Content in Angular with Stripe Payments - Part 3
Fireship
Angular 4 Full Text Search with Algolia - Part 1
Fireship
Algolia with Firebase Cloud Functions - Part 2
Fireship
Firebase Phone Authentication in Angular 4
Fireship
Top 7 RxJS Concepts for Angular Developers
Fireship
Learn Angular Animations with 5 Examples
Fireship
Advanced Firebase Data Filtering (Multi-Property)
Fireship
Realtime Maps with Mapbox + Firebase + Angular
Fireship
Angular Reactive Forms with Firebase Database Backend
Fireship
Send Push Notifications in Angular with Firebase Cloud Messaging
Fireship
Top 7 Ways to Debug Angular 4 Apps
Fireship
Infinite Scroll with Angular and Firebase
Fireship
Use TypeScript with Firebase Cloud Functions
Fireship
Realtime Graphs and Charts with Plotly and Firebase
Fireship
Role-Based User Permissions in Firebase
Fireship
User Presence System in Realtime - Online, Offline, Away
Fireship
Location-based Queries with GeoFire and Angular Google Maps
Fireship
Angular ngrx Redux Quick Start Tutorial
Fireship
Angular Ngrx Effects with Firebase Database
Fireship
Progressive Web Apps with Angular
Fireship
Angular Ngrx with Firebase Google OAuth User Authentication
Fireship
RxJS Quick Start with Practical Examples
Fireship
Send SMS Text Messages with Twilio and Firebase
Fireship
Firebase Database Performance Profiling
Fireship
Native Desktop Apps with Angular and Electron
Fireship
Subscription Payments with Stripe, Angular, and Firebase
Fireship
Firestore with AngularFire5 Quick Start Tutorial
Fireship
Angular HTTP Client Quick Start Tutorial
Fireship
Google Sign-In with Firestore Custom User Data
Fireship
Star Review System from Scratch with Firestore + Angular
Fireship
Angular Chatbot with Dialogflow (API.ai)
Fireship
Learn @ngrx/entity and Feature Modules
Fireship
Infinite Scroll Pagination with Firestore
Fireship
Faster Firestore via Data Aggregation
Fireship
Contentful - CMS for Angular Progressive Web Apps
Fireship
More on: AI Pair Programming
View skill →Related Reads
📰
📰
📰
📰
Data Structures & Algorithms for Mobile App Developers
Medium · Programming
Data Structures and Algorithms Deep‑Dive — Real-world Applications of Hash Tables (Chapter 3…
Medium · Programming
Data Structures and Algorithms Deep‑Dive — Real-world Applications of Hash Tables (Chapter 3…
Medium · Python
Day 29/100 Koko Eating Bananas (Binary Search)
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI