11
votes
Accepted
Memory Management - Why certain initializations order are faster?
Such an effect happens because of how the data of the int** a is stored in memory (as per C/C++). This question on StackOverflow has answers with some more details (...
6
votes
Accepted
Inefficient comparisons of custom data type C++
Why not this, which avoids the inequality comparison before the less-than altogether:
...
4
votes
Accepted
Efficient way to store array where elements are added and removed frequently
Let me start with the following: Even very good and experienced programmers have a very hard time estimating whether a particular piece of code is performance critical or not. This has given rise to ...
4
votes
How to store a TB size array in C++ on a cluster
You could try using UPC++, which sets up a globally accessible address space distributed across your nodes.
A more standard approach would be to learn how to use MPI.
4
votes
Accepted
Space complexity of a semidefinite program
For a problem with $m$ linear equality constraints and a $n$ by $n$ matrix variable, the problem data $A$, $b$, $C$ requires $O(mn^{2})$ storage for $A$, $O(m)$ storage for $b$, and $O(n^{2})$ storage ...
3
votes
Accepted
Memory issues with iterative solvers
As you pointed out, your matrices are sparse which means that the number of non-zeros is small compared to the number of zeros. There are several formats to store such matrices, e.g. COO, CSC, CSR etc....
3
votes
How can we solve the normal equations with limited memory?
That might also have been a trick question. Let's say you want to solve the normal equations for $Ax=b$, i.e., $(A^T A) x = A^T b$. Let's assume for a moment that the questioner meant that $A$ is ...
3
votes
Inefficient comparisons of custom data type C++
Wolfgang's answer is probably the best one, because its almost guaranteed to not screw up in unpredictable ways, and the intent couldn't be more clear. That said...
If the 8 bit integers are unsigned, ...
3
votes
Methods to improve the efficiency and the memory requirement of LU factorization for complex symmetric system matrix
You probably want a factorization of the form $\mathbf A = \mathbf L \mathbf D \mathbf L^T$, it can certainly be applied to a complex symmetric $\mathbf A$. LAPACK implements this factorization within ...
3
votes
Memory Management - Why certain initializations order are faster?
Noting correctly that this is an array of pointers to arrays of ints:
In the first version, the code is accessing element 0 of each successive array of ints, then element 1, etc. That means it is ...
3
votes
Access optimized data structure for representing integer lattice
In essence, you are asking whether you can enumerate the integer lattice sites within your domain from $1$ to $N$ in such a way that accessing the east/west/north/south neighbors of a location $n$ ...
2
votes
Accepted
Reordering algorithm for minimization of ram usage of a skyline matrix
For direct solution in 3D, you should probably be using some flavor of nested dissection (ND) or minimum degree (MD). These attack the storage requirements of A=LL' factorization directly, not the ...
2
votes
Accepted
Why does multithreaded code Segfault in 64-bit but not 32-bit
It's impossible to tell without knowing the code you are using. But fortunately, segmentation faults are easy to debug: basically, a segfault means that you are accessing memory you should not access, ...
2
votes
Accepted
Why does PETSc matrix memory allocation improve performance so much?
Warning: this answer is only going to give a brief overview, for the real details, the one source that won't be wrong is the source code.
The core matrix AIJ format is basically the same as the one ...
2
votes
Accepted
Use of GPU with respect to CPU
Unfortunately, GPUs will be of no help to you in this particular situation. Your problem is in the memory limitation; thus, you just do not have enough RAM resources to allocate/factorize/solve the ...
2
votes
How to store a TB size array in C++ on a cluster
Really the only way to run simulations on a multi-node cluster is to use MPI. And you don't distribute data because that would mean it would start out in one place. With MPI everything is distributed ...
2
votes
How to compute Singular value decomposition of a large matrix with Python
Did you try with Dask ?
https://examples.dask.org/machine-learning/svd.html
You can manage very large matrices. There is also a nice blog post about it https://blog.dask.org/2020/05/13/large-svds
2
votes
Access optimized data structure for representing integer lattice
You can probably speed things up a little bit by storing the array in 4x4 square subarrays so that each of them fit in cache line (64 bytes = 4x4 32-bit integers). This changes the probability ...
2
votes
Inefficient comparisons of custom data type C++
I think it would be faster to assemble a 32-bits integer for each operands and compare them, as you initially intended. It will be equivalent to what you did "by hand".
If numbers stored in ...
1
vote
How can we solve the normal equations with limited memory?
Among approximate techniques:
Gradient descent should do a decent job, given the limitations.
Randomized SVD is an effective technique. It is quick to implement, and there are ready-to-use error ...
1
vote
How can we solve the normal equations with limited memory?
So called “matrix free” methods, relying primarily on the ability to perform multiplication of the matrix by a vector, lend themselves nicely to iterative techniques such as GMRES. The matrix itself ...
1
vote
Accepted
Understading memory sharing in a GPGPU using a lattice example
The GPU consists of several streaming multiprocessors.
Each SM has 64-96kB of shared memory that can be accessed by up to 1024-2048 threads. This shared memory allows these threads to communicate.
To ...
1
vote
Doing computations on a very large numpy array: streaming the calculation vs out-of-core memory
A lot of this will depend on the details of your do_big_calculation function.
In general you want to avoid pushing data to disk for performance reasons. Disk I/O ...
1
vote
Accepted
Minimizing the used memory in diffusion simulation using Python
It seems that you are going from one extreme to the other: you probably want to generate all $N$ particles at once without the for-loop; however, you don't want to generate all the ...
1
vote
Finite difference - Explicit / Implicit / Crank Nicolson - Does the implicit method require the least memory?
You seem to have given the 1D equations for the discretizations, even though the problem is in 2D.
Regardless, the explicit method requires the least memory since you don't even have to form a ...
1
vote
Accepted
Compare 64gb dd3 ram with 2gb Quadro M1000M gpu on Lenovo P50
In my opinion there is not a memory type better than other. Simply they are different things.
Normal ram are used only by the cpu, and the gpu ram is used onnly by the gpu.
This is quite clear when ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
memory-management × 41c++ × 8
linear-solver × 6
parallel-computing × 6
python × 4
matrix × 4
sparse-matrix × 4
fortran × 4
efficiency × 4
petsc × 3
gpu × 3
data-storage × 3
linear-algebra × 2
optimization × 2
matlab × 2
finite-difference × 2
iterative-method × 2
performance × 2
numpy × 2
hpc × 2
c × 2
complexity × 2
mpi × 2
eigen × 2
finite-element × 1