Commit 70ba6f69 authored by Martin Perdacher's avatar Martin Perdacher
Browse files

removed papi

parent 53632047
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.6)
project(blasJoin)

set(UTIL_SOURCES util/dataIo.cpp util/arguments.cpp util/allocation.cpp measure/energy.cpp measure/papicalls.cpp measure/timer.cpp)
set(UTIL_SOURCES util/dataIo.cpp util/arguments.cpp util/allocation.cpp measure/energy.cpp measure/timer.cpp)
set(SOURCE_FILES main.cpp blasJoin/blasJoin.cpp ${UTIL_SOURCES})

#####################
@@ -15,9 +15,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
  set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -xmic-avx512 -qopenmp -DNDEBUG -O3 -lmkl_intel_thread  -liomp5 -lpthread -lmkl_core -lmkl_intel_lp64 -lboost_system")
  # set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -qopt-report=2")

  # xeon phi (knl) specific:
  # set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -lmemkind")
  add_definitions(-DDEBUG)
endif()

+3 −12
Original line number Diff line number Diff line

#include "blasJoin.h"

void blasJoinCountOnly(const double *x, const size_t N, const size_t D, const double EPS, const unsigned int THREADS, const size_t BLOCKSIZE, size_t *joinCounts, CounterBin * hwcounters){
void blasJoinCountOnly(const double *x, const size_t N, const size_t D, const double EPS, const unsigned int THREADS, const size_t BLOCKSIZE, size_t *joinCounts){

    assert( BLOCKSIZE < N && BLOCKSIZE < 21000 && BLOCKSIZE > 1);

    double elapsed=0.0;
    // CUtilTimer timer;
    PapiBin papi_bin;
    double *iresult = NULL;

    *joinCounts = 0;
@@ -21,7 +20,6 @@ void blasJoinCountOnly(const double *x, const size_t N, const size_t D, const do
    iresult = (double*) ddr_alloc(BLOCKSIZE * BLOCKSIZE * sizeof(double));

    // timer.start();
    papi_bin.start();

    const double EPS_SQUARED = (EPS * EPS) / 4.0 ;

@@ -96,22 +94,18 @@ void blasJoinCountOnly(const double *x, const size_t N, const size_t D, const do
    }

    // timer.stop();
    papi_bin.stop();
    *hwcounters = papi_bin.getBin();

    ddr_free(iresult);
    ddr_free(p);
}


/* returns energy consumption [watthours] */
void blasJoinStoreResults(const double *x, const size_t N, const size_t D, const double EPS, const unsigned int THREADS, const size_t BLOCKSIZE, size_t *joinCounts, CounterBin * hwcounters, boost::lockfree::queue<join_pair> &queue){
void blasJoinStoreResults(const double *x, const size_t N, const size_t D, const double EPS, const unsigned int THREADS, const size_t BLOCKSIZE, size_t *joinCounts, boost::lockfree::queue<join_pair> &queue){

    assert( BLOCKSIZE < N && BLOCKSIZE < 21000 && BLOCKSIZE > 1);

    double elapsed=0.0;
    // CUtilTimer timer;
    PapiBin papi_bin;
    double *iresult = NULL;

    *joinCounts = 0;
@@ -125,7 +119,6 @@ void blasJoinStoreResults(const double *x, const size_t N, const size_t D, const
    iresult = (double*) ddr_alloc(BLOCKSIZE * BLOCKSIZE * sizeof(double));

    // timer.start();
    papi_bin.start();

    const double EPS_SQUARED = (EPS * EPS) / 4.0 ;

@@ -239,8 +232,6 @@ void blasJoinStoreResults(const double *x, const size_t N, const size_t D, const
    }

    // timer.stop();
    papi_bin.stop();
    *hwcounters = papi_bin.getBin();

    ddr_free(iresult);
    ddr_free(p);
+2 −3
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
#include "../util/allocation.h"
// #include "../util/timer.h"
#include "../measure/energy.h"
#include "../measure/papicalls.h"
#include "../util/dataIo.h"

#include <boost/lockfree/queue.hpp>
@@ -24,8 +23,8 @@ struct join_pair {
    size_t p2;
};

void blasJoinCountOnly(const double *x, const size_t N, const size_t D, const double EPS, const unsigned int THREADS, const size_t BLOCKSIZE, size_t *joinCounts, CounterBin * hwcounters);
void blasJoinCountOnly(const double *x, const size_t N, const size_t D, const double EPS, const unsigned int THREADS, const size_t BLOCKSIZE, size_t *joinCounts);

void blasJoinStoreResults(const double *x, const size_t N, const size_t D, const double EPS, const unsigned int THREADS, const size_t BLOCKSIZE, size_t *joinCounts, CounterBin * hwcounters, boost::lockfree::queue<join_pair> &que);
void blasJoinStoreResults(const double *x, const size_t N, const size_t D, const double EPS, const unsigned int THREADS, const size_t BLOCKSIZE, size_t *joinCounts, boost::lockfree::queue<join_pair> &que);

#endif
+3 −4
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ int consumer(boost::lockfree::queue<join_pair> &queue)
#endif

int main(int argc, char** argv) {
    CounterBin hwcounters;
    char filename[255] = "";
    double watthours=0.0;
    bool isBinary = false;
@@ -65,9 +64,9 @@ int main(int argc, char** argv) {
    }

#ifdef COUNT_ONLY
    blasJoinCountOnly( x, N, D, EPS, threads, blocksize, &joinCounts, &hwcounters);
    blasJoinCountOnly( x, N, D, EPS, threads, blocksize, &joinCounts);
#else
    blasJoinStoreResults( x, N, D, EPS, threads, blocksize, &joinCounts, &hwcounters, queue);
    blasJoinStoreResults( x, N, D, EPS, threads, blocksize, &joinCounts, queue);
#endif

#ifndef COUNT_ONLY
@@ -82,7 +81,7 @@ int main(int argc, char** argv) {
#pragma omp parallel
{
    if (  omp_get_thread_num() == 0 ){
        printf("%ld;%ld;%2.12f;%ld;%d;%f;%lu;%f\n", N, D, EPS, blocksize, omp_get_num_threads(), hwcounters.rtime, joinCounts, hwcounters.whours);
        printf("%ld;%ld;%2.12f;%ld;%d;%lu\n", N, D, EPS, blocksize, omp_get_num_threads(), joinCounts);
    }
}

cmake/measure/papicalls.cpp

deleted100644 → 0
+0 −60
Original line number Diff line number Diff line

#include "papicalls.h"

PapiBin::PapiBin(){
    // int num_hwcntrs;
    // if ((num_hwcntrs = PAPI_num_counters()) < 0 ){
    //     if ((num_hwcntrs = PAPI_num_counters()) < NUM_EVENTS ){
    //         fprintf(stderr,"Info:: This installation does not support PAPI: %s\n", PAPI_strerror(num_hwcntrs));
    //         exit(1);
    //     }
    // }
    //
    // if ((num_hwcntrs = PAPI_num_counters()) < NUM_EVENTS ){
    //     fprintf(stderr,"Info:: This machine does not provide sufficient hardware counters.\n");
    //     exit(1);
    // }
}

void PapiBin::start(){
    int retval=0;

    // counters.l1 = 0; // counters.l2 = 0; counters.l3 = 0;
    // counters.rtime = 0.0; counters.ptime = 0.0; counters.flops = 0; counters.mflops;

    // if ( ( retval = PAPI_flops( &counters.rtime, &counters.ptime, &counters.flops, &counters.mflops ) ) < PAPI_OK ){
    //     fprintf(stderr,"Call to PAPI_flops failed: %s\n", PAPI_strerror(retval));
    //     exit(1);
    // }
    energy_consume.reset(); energy_consume.start();
    timer.start();

    // if ((retval = PAPI_start_counters(events, NUM_EVENTS)) < PAPI_OK) {
    //     fprintf(stderr, "PAPI failed to start counters: %s\n", PAPI_strerror(retval));
    //     exit(1);
    // }
}

void PapiBin::stop(){
    // int retval=0;
    // long_long values[NUM_EVENTS];
    //
    // if ((retval = PAPI_stop_counters(values, NUM_EVENTS)) < PAPI_OK) {
    //     fprintf(stderr, "PAPI failed to start counters: %s\n", PAPI_strerror(retval));
    //     exit(1);
    // }

    // if ( ( retval = PAPI_flops( &counters.rtime, &counters.ptime, &counters.flops, &counters.mflops ) ) < PAPI_OK ){
    //     fprintf(stderr,"Call to PAPI_flops failed: %s\n", PAPI_strerror(retval));
    //     exit(1);
    // }
    timer.stop();
    energy_consume.stop();
    counters.rtime = timer.get_time();
    counters.whours = energy_consume.getWH();

}

CounterBin PapiBin::getBin(){
    return counters;
}
Loading