diff --git a/examples/vecadd_mpi/vecadd_mpi_main.cpp b/examples/vecadd_mpi/vecadd_mpi_main.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Texas Instruments Incorporated nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-#include <iostream>
-#include <cstdlib>
-#include <vector>
-#include <stdio.h>
-#include <time.h>
-#include "mpi.h"
-
-using namespace std;
-
-const int NumElements = 8*1024;
-
-#define RAND_MAX_A 64
-#define RAND_MAX_B 256
-#define EPISILON 0.00001
-#define MASTER 0
-
-float srcA [NumElements];
-float srcB [NumElements];
-float dst [NumElements];
-float Golden[NumElements];
-
-extern "C" {
- extern void vadd_openmp(float *a,
- float *b,
- float *c,
- int work_size
- );
-}
-
-/* ======================================================================== */
-/* MAIN */
-/* ======================================================================== */
-int main()
-{
- int num_errors = 0;
- const int print_nerrors = 12;
- int mpi_rank, mpi_size, work_size;
- int total_work, node_work, work_remainder, work_end;
- vector<int> work_sizes;
- vector<int> work_starts;
-
- MPI::Init();
- mpi_rank = MPI::COMM_WORLD.Get_rank();
- mpi_size = MPI::COMM_WORLD.Get_size();
-
- /* ---------------------------------------------------------------- */
- /* Calculate work distribution */
- /* ---------------------------------------------------------------- */
- total_work = NumElements;
- node_work = total_work / mpi_size;
- work_remainder = total_work % mpi_size;
- for (int i=0; i<mpi_size; ++i)
- {
- if (work_remainder == 0)
- {
- work_sizes.push_back(node_work);
- }else
- {
- if (total_work > node_work)
- {
- work_sizes.push_back(node_work);
- total_work -= node_work;
- }else
- {
- work_sizes.push_back(total_work);
- }
- }
- work_starts.push_back(i*node_work);
- }
-
- cout << "[Node " << mpi_rank << "]: Initialized work distribution" << std::endl;
- cout << "[Node " << mpi_rank << "]: Work start: " << work_starts[mpi_rank]
- << ", size: " << work_sizes[mpi_rank] << std::endl;
-
- /* ---------------------------------------------------------------- */
- /* Initialize parts of input arrays srcA, srcB, and Golden array */
- /* with random data in each node and synchronize Golden with master */
- /* ---------------------------------------------------------------- */
-
- /* Initialize Random Number Seed */
- srand(time(NULL));
-
- /* Generate Random Numbers and Golden sections */
- work_end = work_starts[mpi_rank] + work_sizes[mpi_rank];
- for (int i=work_starts[mpi_rank]; i<work_end; ++i)
- {
- srcA[i] = (rand() % RAND_MAX_A + 1) * 1.0;
- srcB[i] = (rand() % RAND_MAX_B + 1) * 1.0;
- dst[i] = 0;
- Golden[i] = srcA[i] + srcB[i];
- }
-
- cout << "[Node " << mpi_rank << "]: Generated random numbers" << std::endl;
-
- /* ---------------------------------------------------------------- */
- /* Send Golden sections to master for final error checking */
- /* ---------------------------------------------------------------- */
- int golden_msg_tag = 0;
- if ( mpi_rank != MASTER )
- {
- MPI::COMM_WORLD.Send (&Golden[work_starts[mpi_rank]],
- work_sizes[mpi_rank],
- MPI::FLOAT,
- MASTER,
- golden_msg_tag
- );
- }else
- {
- for (int i = MASTER + 1; i < mpi_size; ++i)
- {
- MPI::COMM_WORLD.Recv (&Golden[work_starts[i]],
- work_sizes[i],
- MPI::FLOAT,
- MPI::ANY_SOURCE,
- golden_msg_tag
- );
- }
- }
- /* ---------------------------------------------------------------- */
- /* Call vadd_openmp target code on each node's work section */
- /* ---------------------------------------------------------------- */
- cout << "[Node " << mpi_rank << "]: Started vector addition" << std::endl;
-
- vadd_openmp(srcA + work_starts[mpi_rank],
- srcB + work_starts[mpi_rank],
- dst + work_starts[mpi_rank],
- work_sizes[mpi_rank]
- );
-
- cout << "[Node " << mpi_rank << "]: Finished vector addition" << std::endl;
-
- /* ---------------------------------------------------------------- */
- /* Send computed work sections in dst to master */
- /* ---------------------------------------------------------------- */
- int dst_msg_tag = 1;
- if ( mpi_rank != MASTER )
- {
- MPI::COMM_WORLD.Send (&dst[work_starts[mpi_rank]],
- work_sizes[mpi_rank],
- MPI::FLOAT,
- MASTER,
- dst_msg_tag
- );
- }else
- {
- for (int i = MASTER + 1; i < mpi_size; ++i)
- {
- MPI::COMM_WORLD.Recv (&dst[work_starts[i]],
- work_sizes[i],
- MPI::FLOAT,
- MPI::ANY_SOURCE,
- dst_msg_tag
- );
- }
- }
-
- /* ---------------------------------------------------------------- */
- /* Perform error checking on master */
- /* ---------------------------------------------------------------- */
- if (mpi_rank == MASTER)
- {
- for (int i=0; i < NumElements; ++i)
- {
- if (Golden[i] - dst[i] < -EPISILON || Golden[i] - dst[i] > EPISILON)
- {
- if((num_errors += 1) < print_nerrors)
- printf("Error %d: %f <==> %f\n", i, Golden[i], dst[i]);
- }
- }
- if (num_errors > 0)
- {
- cout << "FAIL with " << num_errors << " errors!\n";
- }
- else
- {
- cout << "PASS!" << endl;
- }
- }
-
- MPI::Finalize();
- return 0;
-}