Face Notes Vision Energy telephone interview

Source: Internet
Author: User
Describe the storage level of the CPU

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

    #pragma omp parallel 
    #pragma omp parallel for private (x)
The difference between OpenMP and MPI.

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
Link: https://www.zhihu.com/question/20188244/answer/14552204
Source: Know
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.