Git Product home page Git Product logo

m1-gpu-cpp's Introduction

M1 GPUs for (scientific) computations in C++

In this repo, I explore the capabilities of the Metal Shading Language combined with C++, specifically for use of accelerating scientific codes.

This repo accompaines "Seamless GPU acceleration for C++ based physics using the M1's unified processing units, a case study for elastic wave propagation and full-waveform inversion". If you use VSCode, all instructions to compile can be found in .vscode.

I also wrote a few blog posts about the work in this repo:

However, if you just want to try out the code, make sure you install llvm and libomp using brew and Xcode and its command line tools. By cloning the repo and opening it in VSCode you should have all build configurations.

Additionally, I wrote a preprint (with the actual paper currently in peer-review) on how to use MSL for modelling of PDEs available on arXiv.

m1-gpu-cpp's People

Contributors

larsgeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

m1-gpu-cpp's Issues

Build ok, but execution failed

I was able to build the project, but I got the error below during the execution, do you know why?

2023-05-28 13:17:47.203280+0200 test_cpp[75480:1219121] Metal GPU Frame Capture Enabled
2023-05-28 13:17:47.203665+0200 test_cpp[75480:1219121] Metal API Validation Enabled
Failed to find the default library.
Assertion failed: (commandBuffer != nullptr), function sendComputeCommand, file MetalAdder.cpp, line 79.
(lldb) 
Screenshot 2023-05-28 at 13 22 46 Screenshot 2023-05-28 at 13 22 06 Screenshot 2023-05-28 at 13 19 36

Error when building 02-GeneralArrayOperations

Got this error when building 02-General Array Operations:

Executing task: xcrun -sdk macosx metal -c ~/m1-gpu-cpp/02-GeneralArrayOperations/ops.metal -o ~/m1-gpu-cpp/02-GeneralArrayOperations/ops.air

~/m1-gpu-cpp/02-GeneralArrayOperations/ops.metal:52:13: error: kernel function cannot have input declarations with 'thread_execution_width' and 'threads_per_simdgroup' attributes
kernel void inspector(
^
~/m1-gpu-cpp/02-GeneralArrayOperations/ops.metal:67:24: note: conflicting declaration with 'thread_execution_width' attribute here
uint thread_execution_width [[thread_execution_width]],
^
~/m1-gpu-cpp/02-GeneralArrayOperations/ops.metal:74:24: note: conflicting declaration with 'threads_per_simdgroup' attribute here
uint threads_per_simdgroup [[threads_per_simdgroup]],
^
1 error generated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.