## Vector Processor Characteristics

A **vector processor** is a CPU in a computer with parallel processors and the capability for vector processing. The main characteristic of a vector processor is that it makes use of the parallel processing capability of the processor where two or more processors operate concurrently. This makes it possible for the processors to perform multiple tasks simultaneously or for the task to be split into different subtasks handled by different processors and combined to get the result.

The vector processor considers all of the elements of the vector as one single element as it traverses through the vector in a single loop. Computers with vector processors find many uses that involve computation of massive amounts of data, such as image processing, artificial intelligence, mapping the human genome, space simulations, seismic data, and hurricane predictions.

## Vector Processor Components

Let's now take a closer look at the different components of a vector processor.

### 1. Vector Registers File

The vector register holds the different elements that make up the vector. In the *z* vector, the vector register consists of *z*[0] through *z*[5].

### 2. Vector Address Generator

This generates the start address and the number of elements in each vector.

### 3. Vector Functional Units

These handle arithmetic and logical functions: addition, subtraction, multiplication, division, and square root.

### 4. Vector Data Switch

This is the switch to connect the different components, namely, to connect the processor to the memory modules.

## Vector Processing Architecture

There are two commonly used architectures for parallel vector processing:

- Pipelined vector processors
- Parallel array processors

In a **pipeline**, data processing elements are connected in series. The output of one is the input of the next one, and the elements are executed in parallel, meaning multiple elements can be handled at the same time. For example, to process a person's full name, all first names are processed first, and the resulting first name is combined with the last name to get the full name. In this case, you can get the full name only at the end of the process.

In **parallel array** processing, one process is broken into multiple sub-processes and multiple arrays process each sub-process simultaneously or in parallel. As an example, to process the first and last names, there can be two arrays, one to process first names and the other to process last names. In this case, you can get the full name at any point in time by combining the elements from the arrays and without having to wait until the end of the process.

## Pseudocode: Example

Suppose set A has the numbers {12, 14, 16, 18, 20} and set B has the numbers {30, 32, 34, 36, 38}. You want to multiply each of the elements of set A with each of the corresponding elements of set B and save the answer. So you want to multiply 12 by 30 and save the answer; then multiply 14 by 32 and save the answer, and so on.

Here's an example with pseudocode that doesn't have vector processing:

- Declare 5 variables to save the elements of set A.
- Declare 5 variables to save the elements of set A.
- Get the 1st number from the 1st set.
- Get the 1st number from the 2nd set.
- Multiply the 2 numbers.
- Save the result in a variable.
- Move to the next number.
- Repeat the above steps 30 times.

Now here's an example with pseudocode that has vector processing:

- Declare 1 variable to save the vector A.
- Declare 1 variable to save the vector B.
- Multiply the numbers from vector A with the corresponding numbers from vector B.
- Save the result in a variable.

When not using the vector, each computation has to be repeated 30 times. With vector processing the entire set of 30 variables is treated as one variable. Imagine the time saved with the number of variables is in the tens of thousands!

## Lesson Summary

All right, let's now take a moment or two to review. In this lesson, we learned that **vector processing** is the process of using vectors to store a large number of variables for high-intensity data processing. Weather forecasting, human genome mapping and GIS data are some examples. A **vector processor** is a computer CPU with parallel processors that has the capability for vector processing. In vector processing, multiple tasks are computed concurrently, or the same task is split and computed by different processors and then combined to get the final result.

Large datasets can be saved in an array and the vector processor computes the entire array of variables as though it was a single variable, thus saving tremendous amounts of time. A vector is **dynamic** and can grow or shrink in size as the program executes.

Components of a vector processor are the vector register file, the vector address generator, vector functional units, and vector data switch. The two commonly used architectures for vector processing are pipeline processors and parallel array processors. In a **pipeline**, data processing elements are connected in series and output of one process is the input for the next successive process. In a **parallel array** processor, the process is broken into sub-processes and handled by multiple arrays simultaneously and in parallel.