Commit fd24a4ae authored by perdacherMartin's avatar perdacherMartin

added check for AVX support

parent 73213edd
...@@ -3,7 +3,8 @@ project(MKM) ...@@ -3,7 +3,8 @@ project(MKM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp util/allocation.cpp util/arguments.cpp util/timer.cpp util/dataIo.cpp mckm/mckm.cpp) set(SOURCE_FILES main.cpp mckm/mckm.cpp
util/allocation.cpp util/arguments.cpp util/timer.cpp util/dataIo.cpp)
SET(CMAKE_C_COMPILER gcc) SET(CMAKE_C_COMPILER gcc)
SET(CMAKE_CXX_COMPILER g++) SET(CMAKE_CXX_COMPILER g++)
...@@ -13,7 +14,7 @@ SET(CMAKE_CXX_COMPILER g++) ...@@ -13,7 +14,7 @@ SET(CMAKE_CXX_COMPILER g++)
# set(CMAKE_CXX_FLAGS "-std=c++11") # set(CMAKE_CXX_FLAGS "-std=c++11")
# set(CMAKE_CXX_FLAGS "-march=corei7-avx -O3 -fopenmp -ffast-math -fassociative-math -g -Wa,a,ad") # set(CMAKE_CXX_FLAGS "-march=corei7-avx -O3 -fopenmp -ffast-math -fassociative-math -g -Wa,a,ad")
set(CMAKE_CXX_FLAGS "-std=c++11 -march=corei7-avx -mavx -mavx2 -O3 -fopenmp -ffast-math -fassociative-math -Wa,-q") set(CMAKE_CXX_FLAGS "-std=c++11 -march=corei7-avx -mavx -mavx2 -O3 -fopenmp -ffast-math -fassociative-math -Wa,-q -fpic")
set(CMAKE_LINK_FLAGS "-lm") set(CMAKE_LINK_FLAGS "-lm")
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "util/arguments.h" #include "util/arguments.h"
#include "mckm/mckm.h" #include "mckm/mckm.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
double *means = NULL; double *means = NULL;
double *dmatrix = NULL; double *dmatrix = NULL;
...@@ -20,6 +19,11 @@ int main(int argc, char** argv) { ...@@ -20,6 +19,11 @@ int main(int argc, char** argv) {
int threads = 0; int threads = 0;
int N=64, K=40, D=20; int N=64, K=40, D=20;
#ifndef __AVX__
fprintf (stderr, "Unfortunately your CPU does not support AVX intrinsics. \nExit.");
exit(1);
#endif
parsing_args(argc,argv, &N, &K, &D, &threads, filename, isBinary); parsing_args(argc,argv, &N, &K, &D, &threads, filename, isBinary);
if ( threads != 0 ){ if ( threads != 0 ){
...@@ -33,7 +37,7 @@ int main(int argc, char** argv) { ...@@ -33,7 +37,7 @@ int main(int argc, char** argv) {
means = (double*) ddr_alloc((k + 3)/4*4 * d * sizeof (double)); means = (double*) ddr_alloc((k + 3)/4*4 * d * sizeof (double));
dmatrix = (double*) ddr_alloc(n * d * sizeof (double)); dmatrix = (double*) ddr_alloc(n * d * sizeof (double));
if ( filename == "" ){ if ( strcmp(filename,"") == 0 ) {
random_init(dmatrix,n,d); random_init(dmatrix,n,d);
}else{ }else{
read_file(dmatrix, n, d, filename, isBinary); read_file(dmatrix, n, d, filename, isBinary);
......
...@@ -9,14 +9,14 @@ void parsing_args(int argc, char* argv[], int *n, int *k, int *d, int *threads, ...@@ -9,14 +9,14 @@ void parsing_args(int argc, char* argv[], int *n, int *k, int *d, int *threads,
if ( argc < 4 ){ if ( argc < 4 ){
fprintf (stderr, "The parameters are obligatory.\n"); fprintf (stderr, "The parameters are obligatory.\n");
fprintf (stderr, "Usage: ./blasMeans "); fprintf (stderr, "Usage: ./MKM ");
fprintf(stderr, "Obligatory parameters: \n"); fprintf(stderr, "Obligatory parameters: \n");
fprintf(stderr, "n (number of objects in millions)\nk (number of clusters)\nd (dimensionality)\n"); fprintf(stderr, "n (number of objects in millions)\nk (number of clusters)\nd (dimensionality)\n");
fprintf(stderr, "Optional parameters: \n t number of threads\n\n"); fprintf(stderr, "Optional parameters: \n t number of threads\n\n");
fprintf(stderr, "f (filename) if there is no filename we use random generated data [0.0, 1.0)\n"); fprintf(stderr, "f (filename) if there is no filename we use random generated data [0.0, 1.0)\n");
fprintf(stderr, "b use the -b argument without options to specify that it is a binary file.\n"); fprintf(stderr, "b use the -b argument without options to specify that it is a binary file.\n");
fprintf(stderr, "Example (with default values): ./blasMeans -n 64 -k 40 -d 20 -t 4\n"); fprintf(stderr, "Example (with default values): ./MKM -n 64 -k 40 -d 20 -t 4\n");
exit(1); exit(1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment