**3. Parallel Algorithm**

#### *3.1. MPI Technology*

We can realize data casting, sending, receiving, and synchronizing. The MPI supports several data types [16], including complex. The MPI program is one program, but every process can perform different computations. Every process has an ID, and we can allocate tasks to every process by ID.

The variable's name is the same, but the values of the variables in different processes can be different. If the processes want to share the data, they need to communicate with each other.

#### *3.2. Parallel Algorithm of ZTEM Inversion*

The algorithm needs to perform the calculation many times. A calculation has three parts, namely, solving the equation forward (obtaining the value of *T*), the first pseudoforward solution to the equation of inversion (obtaining the value of Aty), and the second pseudo-forward solution to the equation of inversion (obtaining the value of *Ap*). We analyzed the algorithms of forward and inversion and found that solving the equation is the main work and costs a large proportion of the running time. As with six frequencies, when the frequency is different, we can obtain the k, and k is also different. *K* is in the equation *kv* = *s*. In order to obtain the new *m,* we need to solve the equation 18 times in an iteration process. When there are three processes in the algorithm, every process needs to solve the equation six times. The process needs to solve the equation 18 times in the serial algorithm. The process in the parallel program needs to do less work than the serial program, so the parallel program needs less time to execute the inversion algorithm than the serial program. Therefore, the parallel efficiency is higher [17].

The six frequencies are freq(1) ... freq(6) 400, 200, 100, 50, 20, and 10 Hz. When the frequency is higher than other frequencies, solving the equation needs less time. Two kinds of processes exist in the algorithm. One is the main process and the other is the subprocess. The 0 process is the main process. It owns the global data, distributes the work, sends the data, receives the data, and writes the result files. The subprocesses receive data from the 0 process, perform the work, and send the result to the 0 process. When there are three processes in the parallel program, the 0 process is the main process and the first and second processes are the subprocesses. The 0 process also needs to perform the work in the algorithm. We will introduce the main procedure.


**Table 1.** The allocated frequencies.


In MPI\_Bcast(), the main process broadcasts the data, including m and Aty, to the other processes.

(3) After computing the value of object function *ψ*, the main process can obtain the rms. If rms is less than 1.5, we proceed to step 4; otherwise, we compute the second pseudoforward equation. Every process needs to perform computing separately. Process can obtain the Ap\_mpi. MPI\_recv(), and the main process receives Ap\_mpi from the other processes. The process puts it together and obtains the value of Ap\_all. Ap\_all has six Ap\_mpi, of which the order is 1, 2, 3, 4, 5, and 6. We obtain the *Ap*. In MPI\_Bcast(), the main process broadcasts *Ap* to the subprocesses, and we obtain the value of step length *α*. We can obtain the new model *m* = *m* + *αp*, go to step 2.

(4) The main process writes the *m* data in the result file. In MPI\_FINALIZE(), we finish the parallel environment. The flow chart of the parallel computing of 2D inversion is

**Figure 2.** The flow chart of parallel computing for 2D magnetotelluric.

#### *3.3. Computing Environment*

The program is developed in the environment as shown in Table 2.

**Table 2.** Development environment.


#### **4. Results**
