# Tag Info

37

I'll try to summarize my experiences obtained in the course of developing ViennaCL, where we have CUDA and OpenCL backends with mostly 1:1 translations of a lot of compute kernels. From your question I'll also assume that we are mostly taking about GPUs here. Performance Portability. First of all, there is no such thing as performance-portable kernels in ...

16

Here's the deal with GPUs. On a GPU, every single core is slow. Really slow. However, you have thousands of cores. If you can effectively use the thousands of cores at a time, then your algorithm will run better on the GPU. If you cannot, then it will run much slower on the GPU. Linear algebra is one domain where parallelism is really well established. ...

12

Julia's DifferentialEquations.jl is all GPU-compatible. If you make your arrays GPU-based arrays, then the solver recompiles to be all on the GPU (no data transfers). For example: using OrdinaryDiffEq, CUDA, LinearAlgebra u0 = cu(rand(1000)) A = cu(randn(1000,1000)) f(du,u,p,t) = mul!(du,A,u) prob = ODEProblem(f,u0,(0.0f0,1.0f0)) # Float32 is better on ...

9

I have implemented quite a wide variety of non-linear solvers on the GPU, including LBFGS, Barzilai Borwein gradient descent and non-linear conjugate gradient. For this, the non-linear conjugate gradient of Dai & Yuan has been the most efficient. In general, other version of the nonlinear conjugate gradient may be more efficient (such as CG-DESCENT), ...

8

I am assuming that you are setting the error tolerance at 1e-12. You are correct that when an adaptive scheme accepts the current step size, it assumes the 5th order scheme was, for all intents and purposes, the "correct" answer. However this is only when it accepts the current step. If the difference between the 4th and 5th order steps are too large, it ...

6

There are plenty of finite element libraries out there that satisfy most of your criteria. In no particular order, I would mention deal.II (my own project), libMesh, and FEniCS. All three are large, are libraries, are well documented, are well established with large user bases. All three are actively maintained and are about as fast as you would a general ...

5

To extend Chris Rackauckas's exhaustive answer with a reference try to look pdf by Torres, Gonzalez-Escribano, Llanos. It is about the tuning of a gpu, that is an important aspect for performance. As Bill Greene's comment remembers the most relevant part of the computation work is about solve linear system, but however the assembly part can take a discrete ...

5

I don't know much about tracking implicit surfaces, so I'm just going to start with the optimization problem and go from there. The optimization problem is, at the core, nonlinear least squares, and can therefore be solved efficiently by the Gauss-Newton method, wherein at each step one linearizes the problem at the current guess, solves the linear least ...

5

I suppose, you right and your network is not that big to 100%-utilize the GPU. The bottle-neck here seems to be not the GPU itself, but the transfer rate between RAM and VRAM and here the difference between 750 Ti and 780 Ti is not that significant. You can try to improve the training speed by hiding the latency of memory transfer - you have to assure you ...

4

I'm using double precision values in the calculation. Is it feasible of me to demand of my integrator that the difference between the 4th and 5th order estimates be < 1 x 10 ^-16 if machine precision is that of a double? Assuming you're talking about absolute error tolerances, in general, yes, it makes sense.. A unit in the last place (ulp) would be the ...

3

Synchronization. You can't synchronize threads across different blocks in the same grid. On the other hand, if you execute kernels the way you do, they are guaranteed to execute in sequence, so all the threads in even_update will see all updates made by odd_update in the same iteration. (See NVIDIA's own documentation.) There is no good way that I know of ...

3

Since your question seems to be specifically about the Raspberry Pi, I would suggest searching for "Raspberry Pi GPGPU" in addition to the book suggested by @Kirill. GPGPU refers to general purpose computing on graphics processing units and should get you results specific to using the RPi's GPU for non-graphics tasks. You should also have a look at the ...

3

I don't know a definitive source, but have a look at "GPU Gems 2", which is a book published by NVIDIA about ten years ago and available online. While much of it is about computer graphics, it has a number of sections devoted to general purpose computing on GPUs from the time before CUDA and OpenCL. I am not familiar enough with Raspberry Pi to tell if this ...

3

Other comments have suggested a file-based interface, using an actual C/C++ optimization library, or extending Python with C++. Those are probably better ways to solve your problem, but here's a more narrow minded answer. To begin, here's a C program called mymodel.c which implements the 2d Rosenbrock function. #include "stdio.h" #include "assert.h" #...

2

As I see it, it makes sense to compare on the level of machine precision. In the worst case you will not be able to satisfy your criterion because of rounding errors, but this is a Type I error (the time step is rejected although it meets the requirement) which is 'safe'. No, this depends on how much an error is amplified by your incremental function. This ...

2

The Intel OpenMP Run Time library has been open sourced, so you might have look at a few functions in there. There are many open source MPI libraries (MPICH2, OpenMPI, MVAPICH2, etc.), and the MPI interface is standardized, so reading the standards document can be enlightening. OpenMP is also standardized, so you might look to that as well. CUDA is basically ...

2

I have found pycuda particularly useful as wrapper for cuda in python. Especially the section on metaprogramming is useful if you are interested in building more sophisticated frameworks. It's a mature package, there is an active mailing list and the developer gives very useful advice.

2

I can't speak to how you would best work with an AMD GPU. However, of the languages you list CUDA could be considered the lowest level, highest-performance language for general applications. This is because it's a hardware-specific language developed by the vendor specifically for their hardware. It can and does offer options that won't translate directly ...

2

I suggest to start form this page, where you can find different project related to OpenFoam that use GPU. Keep in mind that OpenFoam was born with the intent to resolve practical case in applied problems, think its typical user as an engineer. In this kind of program is normal to develop a layer that hide the implementation, so the user principal work is to ...

2

Structural and numerical zeros describe how zero values in your matrix are stored. Structural zeros are zeros that are implied to be zero because they are not present in the data structure. Numerical zeros are zeros that are explicitly stored. For example, the matrix \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} can be stored in coordinate format ...

1

It seems that cusparse library expects the CSR matrix to be ordered. If the matrix is not ordered, the cusparse functions fail. Ordering helps to fix the above mentioned issue.

1

I don't have enough reputation, so I (have to) post an answer instead of a comment. An alternative is to use the HIP compiler with its own language. See here: https://github.com/ROCm-Developer-Tools/HIP In addition to the GPU-agnostic language, this compiler seems to be able to transform CUDA code to be executed on AMD GPUs.

1

Both CPUs you list are much more powerful than your existing laptop and assuming you're getting even reasonable parallelism out of the loop should contribute significant speedup. Without knowing your specific application I [personal opinion] would likely choose the processor with fewer faster cores since on a wide variety of tasks single core performance is ...

1

Pycuda is one of the more pythonic way to handle cuda in python as @nluigi suggested. If you are open to call C/C++ code inside python there is also CUSP: Cusp is a library for sparse linear algebra and graph computations based on Thrust. Cusp provides a flexible, high-level interface for manipulating sparse matrices and solving sparse linear systems. ...

1

It is a different approach but maybe you could do a point cloud surface reconstruction using total variation denoising as in here. They have a demo code that you could use as a base for your implementation, you can get it here. The paper also shows other alternatives, the Poisson surface reconstruction also shows nice results. The poisson surface ...

1

Some of the standard methods for random rotations in 3D (Sphere Point Picking) are listed on Mathworld. On a CPU, Marsaglia's method is quite efficient, because it avoids expensive $\sin$ and $\cos$ computations. Marsaglia's method isn't really suitable for a GPU, because it sometimes rejects pairs of random numbers. If you have access to fast ...

1

I'm not sure if this would be a better fit for the StackOverflow, but here goes. The best way to do this is to make a new type, which contains the allocatable array for that particular GPU. Have a look at this article from the Portland Group, describing how to do multi-GPU computations with CUDA Fortran.

1

A few constraints that usually work in scientific SPH (weakly compressible) computations: particle radius or influence radius, $\Delta$: define it arbitrarily to set the resolution. smoothing radius, $h$: it depends on the kernel function, in your case $h=\Delta/4$. rest density $\rho_0$: 1000 for water. particle mass, $m$: The number of neighbours in 3D ...

1

Your target size of 10,000 degrees of freedom should be easy to meet without embedding an entire FEM library (which may anyway be hard to do, as others have pointed out), and in much less than a second. Assuming that solving the system is your current bottleneck and not assembling it (check this first), I would recommend you to use any of the existing and ...

1

Since you want your program to be embedded in a game, something like a physics engine for structures, a good idea is to use an explicit FEM. Something similar to this simulations done with Verlet algorithm. The explicit FEM can be really fast if you can have a structured mesh, because in that way all the stiffness matrices for the elements are the same (you ...

Only top voted, non community-wiki answers of a minimum length are eligible