The operating system on Salomon is Linux - [**CentOS 6.x**](https://en.wikipedia.org/wiki/CentOS)
The CentOS Linux distribution is a stable, predictable, manageable and reproducible platform derived from the sources of Red Hat Enterprise Linux (RHEL).
PAPI currently supports only a subset of counters on the Intel Xeon Phi processor compared to Intel Xeon, for example the floating point operations counter is missing.
To use PAPI in [Intel Xeon Phi](../../anselm/software/intel-xeon-phi/) native applications, you need to load module with " -mic" suffix, for example " papi/5.3.2-mic" :
To use PAPI in [Intel Xeon Phi](../intel-xeon-phi/) native applications, you need to load module with " -mic" suffix, for example " papi/5.3.2-mic" :
printf("Value mismatch at location %d, values %d and %dn",i, a[i], b[i]);
pass = 1;
}
}
if (pass == 0) printf ("Test passedn");else printf("Test Failedn");
return pass;
}
// Parallel loop from main function
#pragma omp parallel for
for(i=0;i<SIZE;i++)
res[i]=in1[i]+in2[i];
int main()
{
int i;
random_T(in1, SIZE);
random_T(in2, SIZE);
// or parallel loop is called inside the function
add_mic(in1,in2,res,SIZE);
#pragma offload target(mic)in(in1,in2) inout(res)
{
}
// Parallel loop from main function
#pragma omp parallel for
for (i=0;i<SIZE; i++)
res[i] = in1[i] + in2[i];
//Check the results with CPU implementation
Tres_cpu[SIZE];
add_cpu(in1,in2,res_cpu,SIZE);
compare(res,res_cpu,SIZE);
// or parallel loop is called inside the function
add_mic(in1, in2, res, SIZE);
}
//Check the results with CPU implementation
T res_cpu[SIZE];
add_cpu(in1, in2, res_cpu, SIZE);
compare(res, res_cpu, SIZE);
}
}
```
During the compilation Intel compiler shows which loops have been vectorized in both host and accelerator. This can be enabled with compiler option "-vec-report2". To compile and execute the code run
...
...
@@ -271,61 +271,61 @@ $ module load intel
Following example show how to automatically offload an SGEMM (single precision - general matrix multiply) function to MIC coprocessor. The code can be copied to a file and compiled without any necessary modification.
An example of basic MPI version of "hello-world" example in C language, that can be executed on both host and Xeon Phi is (can be directly copy and pasted to a .c file)
```cpp
#include <stdio.h>
#include <mpi.h>
#include <stdio.h>
#include <mpi.h>
intmain(argc,argv)
intargc;
char*argv[];
{
intrank,size;
intmain(argc,argv)
intargc;
char*argv[];
{
intrank,size;
intlen;
charnode[MPI_MAX_PROCESSOR_NAME];
intlen;
charnode[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc,&argv);/* starts MPI */
MPI_Comm_rank(MPI_COMM_WORLD,&rank);/* get current process id */
MPI_Comm_size(MPI_COMM_WORLD,&size);/* get number of processes */
MPI_Init(&argc,&argv);/* starts MPI */
MPI_Comm_rank(MPI_COMM_WORLD,&rank);/* get current process id */
MPI_Comm_size(MPI_COMM_WORLD,&size);/* get number of processes */
MPI_Get_processor_name(node,&len);
MPI_Get_processor_name(node,&len);
printf("Hello world from process %d of %d on host %s n",rank,size,node);
MPI_Finalize();
return0;
}
printf("Hello world from process %d of %d on host %s n",rank,size,node);
A very basic example of code that employs offload programming technique is shown in the next listing. Please note that this code is sequential and utilizes only single core of the accelerator.
```console
```cpp
$catsource-offload.cpp
#include <iostream>
...
...
@@ -190,7 +190,7 @@ $ ./bin-offload
One way of paralelization a code for Xeon Phi is using OpenMP directives. The following example shows code for parallel vector addition.
```console
```cpp
$cat./vect-add
#include <stdio.h>
...
...
@@ -317,7 +317,7 @@ $ ml intel
The code can be copied to a file and compiled without any necessary modification.
@@ -60,7 +60,7 @@ Octave may use MPI for interprocess communication This functionality is currentl
## Xeon Phi Support
Octave may take advantage of the Xeon Phi accelerators. This will only work on the [Intel Xeon Phi](../../salomon/software/intel-xeon-phi/)[accelerated nodes](../../salomon/compute-nodes/).
Octave may take advantage of the Xeon Phi accelerators. This will only work on the [Intel Xeon Phi](../intel-xeon-phi/)[accelerated nodes](../../salomon/compute-nodes/).