Commit 329263d1 authored by Cabaret Laurent's avatar Cabaret Laurent
Browse files

Add a commandline selector for the input file

parent 4532afba
CPUCC = g++
GPUCC = /usr/local/cuda/bin/nvcc
GPUCC = nvcc
# For RTX 2080 Ti
CUDA_TARGET_FLAGS = --gpu-architecture=sm_75
......
......@@ -20,7 +20,8 @@ cluster_dim3 = [60, 60, 40, 40]
cluster_dim4 = [60, 40, 60, 40]
# initialize the nb of points within each cluster and sum up the total nb of points
nb_points = [12500000, 12500000, 12500000, 12500000]
points_per_cluster = 2500000 # 12500000
nb_points = [points_per_cluster, points_per_cluster, points_per_cluster, points_per_cluster]
sum_np = sum(nb_points)
# initialize arrays dedicated to store the coordinates and the cluster label of points
......
......@@ -3,6 +3,7 @@
#include <string.h>
#include <math.h>
#include <omp.h>
#include <string>
#include "main.h"
#include "init.h"
......@@ -20,6 +21,7 @@ T_real *data; // Array for the matrix of data instanc
T_real *dataT; // Array for the transponsed matrix of data instances
T_real centroid[NbClusters][NbDims]; // Centroids
T_real package[NbClusters][NbDims]; // Package
std::string INPUT_FILE; // Input file
int *label; // Array for cluster labels of data points
unsigned long long int track; // Number of points changing label between two iterations
int count[NbClusters]; // Number of points in each cluster
......@@ -51,7 +53,7 @@ void InputDataset(void)
label = (int *) malloc(NbPoints*sizeof(int));
// Load input data from a text file
fp = fopen(INPUT_DATA, "r");
fp = fopen(INPUT_FILE.c_str(), "r");
if (fp == NULL) {
printf(" Fail to open data file!\n");
exit(0);
......@@ -192,6 +194,7 @@ void CommandLineParsing(int argc, char *argv[])
OnGPUFlag = DEFAULT_ONGPUFLAG;
MaxNbIters = DEFAULT_MAX_NB_ITERS;
TOL = DEFAULT_TOL;
INPUT_FILE = INPUT_DATA;
// Init from the command line
argc--; argv++;
......@@ -252,6 +255,15 @@ void CommandLineParsing(int argc, char *argv[])
usage(EXIT_FAILURE, stderr);
}
} else if (strcmp(argv[0],"-file") == 0) {
argc--; argv++;
if (argc > 0) {
INPUT_FILE = argv[0];
argc--; argv++;
} else {
usage(EXIT_FAILURE, stderr);
}
} else if (strcmp(argv[0],"-h") == 0) {
usage(EXIT_SUCCESS, stdout);
} else {
......
......@@ -2,11 +2,11 @@
/* Define constants */
/*-----------------------------------------------------------------------------------------*/
// Benchmark dataset
#define NbPoints 50000000 // Number of data instances
#define NbPoints 1000000 // Number of data instances (50000000)
#define NbDims 4 // Number of dimensions
#define NbClusters 4 // Number of clusters
#define NbPackages 100 // Number of packages used for UpdateCentroids
#define INPUT_DATA "/usr/users/.../datasets/SyntheticDataset.txt"
#define INPUT_DATA "./datasets/SyntheticDataset.txt"
#define INPUT_INITIAL_CENTROIDS "" // Optional
// Adjustable block size
......
Supports Markdown
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