Skip to content

Commit

Permalink
Removed too big input file.
Browse files Browse the repository at this point in the history
  • Loading branch information
p-jacquot committed May 7, 2021
1 parent d674387 commit b8e5031
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 494,024 deletions.
7 changes: 7 additions & 0 deletions apps/rodinias/kmeans/create_inputs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash

echo -e "Creating input file."
cd inputGen
make
./datagen 1000
mv 1000_34.txt ../
6 changes: 6 additions & 0 deletions apps/rodinias/kmeans/inputGen/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
datagen: datagen.cpp
g++ -o $@ $<

clean:
rm datagen

82 changes: 82 additions & 0 deletions apps/rodinias/kmeans/inputGen/datagen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* datagen.cpp
* by Sam Kauffman - University of Virginia
*
* This program generates datasets for Rodinia's kmeans
*
* Usage:
* datagen <numObjects> [ <numFeatures> ] [-f]
*
* numFeatures defaults to 34
* Features are integers from 0 to 255 by default
* With -f, features are floats from 0.0 to 1.0
* Output file is "<numObjects>_<numFeatures>.txt"
* One object per line. The first number in each line is an object ID and is
* ignored by kmeans.
*
*/

#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <ctime>

using namespace std;

int main( int argc, char * argv[] )
{
if ( argc < 2 )
{
cerr << "Error: Specify a number of objects to generate.\n";
exit( 1 );
}
int nObj = atoi( argv[1] );
int nFeat = 0;
if ( argc > 2 )
nFeat = atoi( argv[2] );
if ( nFeat == 0 && argc > 3 )
nFeat = atoi( argv[3] );
if ( nFeat == 0 )
nFeat = 34;
if ( nObj < 1 || nFeat < 1 )
{
cerr << "Error: Invalid argument(s).\n";
exit( 1 );
}
bool floats = false;
if ( ( argc > 2 && strcmp( argv[2], "-f" ) == 0 ) || ( argc > 3 && strcmp( argv[2], "-f" ) == 0 ) )
floats = true;

stringstream ss;
string f = floats ? "f" : "";
ss << nObj << "_" << nFeat << f << ".txt";
ofstream outf( ss.str().c_str(), ios::out | ios::trunc );
srand( time( NULL ) );

if ( !floats )
for ( int i = 0; i < nObj; i++ )
{
outf << i << " ";
for ( int j = 0; j < nFeat; j++ )
outf << ( rand() % 256 ) << " ";
outf << endl;
}
else
{
outf.precision( 4 );
outf.setf( ios::fixed );
for ( int i = 0; i < nObj; i++ )
{
outf << i << " ";
for ( int j = 0; j < nFeat; j++ )
outf << ( (float)rand() / (float)RAND_MAX ) << " ";
outf << endl;
}
}

outf.close();
string type = floats ? " \"float\"" : " \"int\"";
cout << "Generated " << nObj << " objects with " << nFeat << type << " features in " << ss.str() << ".\n";
}
25 changes: 25 additions & 0 deletions apps/rodinias/kmeans/inputGen/gen_dataset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

./datagen 100
./datagen 300
./datagen 1000
./datagen 3000
./datagen 10000
./datagen 30000
./datagen 100000
./datagen 300000
./datagen 1000000
./datagen 3000000
./datagen 10000000
./datagen 100 -f
./datagen 300 -f
./datagen 1000 -f
./datagen 3000 -f
./datagen 10000 -f
./datagen 30000 -f
./datagen 100000 -f
./datagen 300000 -f
./datagen 1000000 -f
./datagen 3000000 -f
./datagen 10000000 -f

494,020 changes: 0 additions & 494,020 deletions apps/rodinias/kmeans/kdd_cup.txt

This file was deleted.

7 changes: 5 additions & 2 deletions apps/rodinias/kmeans/kmeans_openmp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ $(PROG): $(SRC)
objdump:
objdump --source $(PROG) > /tmp/objdump.txt && vim /tmp/objdump.txt

test: $(PROG)
../1000_34.txt:
cd ../ && ./create_inputs.sh

test: $(PROG) ../1000_34.txt
OMP_NUM_THREADS=$(CPUS) \
HERMIT_VERBOSE=$(VERBOSE) HERMIT_ISLE=$(ISLE) HERMIT_TUX=1 \
HERMIT_DEBUG=$(DEBUG) HERMIT_SECCOMP=$(SECCOMP) HERMIT_MEM=$(MEM) \
HERMIT_CPUS=$(CPUS) $(HERMIT_LOCAL_INSTALL)/bin/proxy $(KERNEL) \
$(PROG) $(ARGS) -i ../kdd_cup.txt -n $(CPUS)
$(PROG) $(ARGS) -i ../1000_34.txt -n $(CPUS)

clean:
rm -rf *.o $(PROG)
Expand Down
7 changes: 5 additions & 2 deletions apps/rodinias/kmeans/kmeans_serial/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ $(PROG): $(SRC)
objdump:
objdump --source $(PROG) > /tmp/objdump.txt && vim /tmp/objdump.txt

test: $(PROG)
../1000_34.txt:
cd .. && ./create_inputs.sh

test: $(PROG) ../1000_34.txt
OMP_NUM_THREADS=$(CPUS) \
HERMIT_VERBOSE=$(VERBOSE) HERMIT_ISLE=$(ISLE) HERMIT_TUX=1 \
HERMIT_DEBUG=$(DEBUG) HERMIT_SECCOMP=$(SECCOMP) HERMIT_MEM=$(MEM) \
HERMIT_CPUS=$(CPUS) $(HERMIT_LOCAL_INSTALL)/bin/proxy $(KERNEL) \
$(PROG) $(ARGS) -i ../kdd_cup.txt
$(PROG) $(ARGS) -i ../1000_34.txt

clean:
rm -rf *.o $(PROG)
Expand Down

0 comments on commit b8e5031

Please sign in to comment.