You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MaterialPointSolver.jl is a high-performance solver that is backend-agnostic, meaning we only need to write a unified codebase that can run on different accelerator backends. The main computational process of the solver relies on kernel functions implemented by [KernelAbstractions.jl](https://github.com/JuliaGPU/KernelAbstractions.jl), so users do not need to worry about the data migration process from the CPU to other hardware backends.
3
+
***MaterialPointSolver.jl*** is a high-performance solver that is backend-agnostic, meaning we only need to write a unified codebase that can run on different accelerator backends. The main computational process of the solver relies on kernel functions implemented by [KernelAbstractions.jl](https://github.com/JuliaGPU/KernelAbstractions.jl), so users do not need to worry about the data migration process from the CPU to other hardware backends.
4
4
5
-
Users should use MaterialPointSolver.jl, and then selects the backend based on your hardware, for example:
5
+
Users should use ***MaterialPointSolver.jl***, and then selects the backend based on your hardware, for example:
6
6
7
7
```julia-repl
8
8
julia> using MaterialPointSolver
@@ -13,21 +13,6 @@ julia> using CUDA
13
13
# using oneAPI # for Intel gpu
14
14
```
15
15
16
-
Taking the CUDA backend as an example, we define automatic conversion methods in `/ext/CUDAExt/devicehelpfunc_cuda.jl`: `host2device` for transferring data to the device, and `device2host!` for downloading data back to the CPU from the backend.
17
-
18
-
!!! note
19
-
20
-
The reason this solution can succeed is that the structs' (including custom structs) fields only contain `scalar` and `array` types for the kernel function, and currently do not support other forms.
21
-
22
-
Although Julia has a garbage collection mechanism to automatically reclaim memory, we hope to clean up GPU memory usage promptly after each simulation. Currently, in `/ext/CUDAExt/devicehelpfunc_cuda.jl`, we use the function `clean_device!` to do this.
23
-
24
16
!!! note
25
-
26
-
For all functions related to the accelerated backend that are not part of the MPM process, a dedicated implementation may be required in the `/ext` folder.
27
-
28
-
!!! todo
29
17
30
-
Currently,
31
-
1) Memory clean can only be achieved on the Nvidia platform, and other platforms are waiting for it to provide the relevant API.
32
-
2) Metal on the Apple platform does not support FP64 computation precision.
33
-
3) Intel's GPU devices have not been tested, but the code implementation should be relatively easy. Ideally, it should only require filling in some parts of the `/ext` folder.
18
+
In addition to selecting the appropriate backend package, users must also specify the backend when instantiating `Config`, which will be explained in later sections.
The solver provides three main struct types: 1) **Configurations**, 2) **Background grid**, 3) **Material particles**.
4
+
5
+
**Configurations** use the `Config` type and store settings such as simulation time, adaptive time stepping, whether to save results as HDF5, etc.
6
+
7
+
The **Background grid** uses the `DeviceGrid` type and stores information such as grid size, spacing, and number of nodes. Only structured grids are supported.
4
8
5
-
Here is an interactive graph to illustrate the basic structs in this solver.
**Material particles** use the `DeviceParticle` type and represent the discrete particles of the model, storing quantities such as particle count, velocity, stress, and more.
10
10
11
-
Green blocks are structs that users need to interact with, and they follow a similar hierarchical logic. To maximize support for users to easily implement custom algorithms, we have added an Extra structure to each structure. For example, for `Particle`, it is `UserParticleExtra`.
11
+
Both `DeviceGrid`and `DeviceParticle` support the plugin system. If the default fields are not sufficient (which is true in most cases), users may add custom fields.
12
12
13
13
!!! note
14
14
15
-
Although `Args` has a user-customizable struct called `UserArgsExtra`, like other `Args`, it cannot be directly used as input for the kernel function; it can only pass its values (bits) to the kernel function.
15
+
Custom fields can only be scalar or array types of Real, e.g., `(custom1 = 1.2, custom2 = rand(10, 2))`.
16
+
17
+
!!! note
16
18
17
-
When the user instantiates green blocks, the data will be automatically transferred between different computing backends based on the user's selection. For internal information about the types, please refer to the source code.
19
+
You are responsible for specifying the numerical precision of custom fields.
0 commit comments