External storage, memory, multilevel cache, registers. How to make full use of CPU caching mechanism.
Enhance the time locality of code and spatial local GPU architecture
The new features of c++11, small cores, global memory, shared memory, threads, line Cheng, and thread grids.
Auto, lambda, move, shared_ptr 、、、 describes the static modifier. Say the static global variable, local variable, member variable initialization time.
The initialization of global variables and member variables is before the main function.
A local variable is initialized the first time the code is executed. What are the multithreading synchronization mechanisms?
Mutex, semaphore, event, message, critical area 、、、 what is shared memory.
Maps a piece of physical memory to the address space of two processes at the same time. The new variable is not necessarily stored in physical memory.
No, the application on the heap, the possibility of virtual memory, and then in the actual operation, the need to transfer data into physical memory, the process is system-responsible. VS Memory analysis tool used not.
No common commands for OpenMP
The difference between OpenMP and MPI.#pragma omp parallel #pragma omp parallel for private (x)
OpenMP and MPI are two means of parallel programming,
The comparison is as follows:
OpenMP: Thread-level (parallel granularity), shared storage, implicit (data-allocation), and poor scalability;
MPI: process level; distributed storage; Explicit (data allocation method); scalability is good.
OpenMP uses shared storage, meaning it only adapts to SMP,DSM machines and is not suitable for clustering.
Although MPI is suitable for a variety of machines, its programming model is complex: it needs to analyze and divide application problems and map the problems to distributed process sets; it needs to solve two major problems of communication latency and load imbalance;
Debugging MPI Program trouble, MPI program reliability is poor, a process problem, the whole program will be wrong;
Author: Lee Super
Copyright belongs to the author. Commercial reprint please contact the author to obtain authorization, non-commercial reprint please indicate the source. Algorithm title: The number of 1-n, each number appears only once, if there is a number into another number, how to find out how this changed the number should be.
Method 1: Quickly sort the number of traversal lookup jumps
Method 2: Open a new array of n size B, initialized to full 0, traversing the original array A, B[a[i]] to 1, and finally traversing the B array, if b[k] = 0, then k for the search. Advanced question: If the number is very much. A 10G size digital file, how to find out the number of this jump variable.
Method 1: First of the 10G file into 100 small files, the first sort of each small file, and then merge the order, and finally traverse the array of ordered, looking for the value of the jump.
Method 2: Hash partition:
Use a[i]/(n/100) as a hash value to divide all numbers into 100 different small files by hash.
Then the question transforms the bit before a conventional question.
If you can directly obtain the number of small files, you can quickly locate the value of the change should be in which small file.