minor update

This commit is contained in:
Blaise Tine
2021-06-22 09:30:36 -07:00
parent c331da5ff7
commit 2372067817
13 changed files with 217 additions and 14036 deletions

View File

@@ -4,8 +4,10 @@ SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf
POCL_CC_PATH ?= /opt/pocl/compiler
POCL_RT_PATH ?= /opt/pocl/runtime
OPTS ?= filelist.txt
VORTEX_DRV_PATH ?= $(realpath ../../../driver)
VORTEX_RT_PATH ?= $(realpath ../../../runtime)
VORTEX_RT_PATH ?= $(realpath ../../../runtime)
K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -float-abi=hard -code-model=small"
K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections"
@@ -34,19 +36,19 @@ $(PROJECT): $(SRCS)
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
run-fpga: $(PROJECT) kernel.pocl
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/opae:$(LD_LIBRARY_PATH) ./$(PROJECT)
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/opae:$(LD_LIBRARY_PATH) ./$(PROJECT) $(OPTS)
run-asesim: $(PROJECT) kernel.pocl
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/opae/ase:$(LD_LIBRARY_PATH) ./$(PROJECT)
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/opae/ase:$(LD_LIBRARY_PATH) ./$(PROJECT) $(OPTS)
run-vlsim: $(PROJECT) kernel.pocl
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/opae/vlsim:$(LD_LIBRARY_PATH) ./$(PROJECT)
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/opae/vlsim:$(LD_LIBRARY_PATH) ./$(PROJECT) $(OPTS)
run-simx: $(PROJECT) kernel.pocl
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/simx:$(LD_LIBRARY_PATH) ./$(PROJECT)
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/simx:$(LD_LIBRARY_PATH) ./$(PROJECT) $(OPTS)
run-rtlsim: $(PROJECT) kernel.pocl
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/rtlsim:$(LD_LIBRARY_PATH) ./$(PROJECT)
LD_LIBRARY_PATH=$(POCL_RT_PATH)/lib:$(VORTEX_DRV_PATH)/rtlsim:$(LD_LIBRARY_PATH) ./$(PROJECT) $(OPTS)
.depend: $(SRCS)
$(CXX) $(CXXFLAGS) -MM $^ > .depend;

View File

@@ -0,0 +1,5 @@
hurricanegen: hurricanegen.c
gcc -std=c99 -o $@ $<
clean:
rm hurricanegen

View File

@@ -0,0 +1,12 @@
#!/bin/bash
./hurricanegen 65536 1
./hurricanegen 131072 1
./hurricanegen 262144 1
./hurricanegen 524288 1
./hurricanegen 1048576 1
./hurricanegen 2097152 1
./hurricanegen 4194304 1
./hurricanegen 8388608 1
./hurricanegen 16777216 1
./hurricanegen 33554432 1

View File

@@ -0,0 +1,13 @@
#!/bin/bash
./hurricanegen 10240 1
./hurricanegen 20480 2
./hurricanegen 40960 4
./hurricanegen 81920 8
./hurricanegen 163840 16
./hurricanegen 327680 32
./hurricanegen 655360 64
./hurricanegen 1310720 128
./hurricanegen 2621440 256
./hurricanegen 5242880 512

View File

@@ -0,0 +1,105 @@
/*
* hurricanegen.c
* Original author unknown
* Modified by Sam Kauffman - University of Virginia
*
* Generates datasets of "hurricanes" to be used by Rodinia's Nearest Neighbor (nn)
* Also generates lists of the files in the dataset. These lists are passed to nn.
*
* Usage: hurricanegen <num_hurricanes> <num_files>
* The number of hurricanes should be a multiple of both 1024 and the number of files.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// 641986 gets you ~30 MB of data
int main(int argc, char **argv)
{
FILE *fp;
int i = 0, total_canes = 0, canes = 0, num_files = 0, j = 0;
int year, month, date, hour, num, speed, press;
float lat, lon;
int hours[4] =
{ 0, 6, 12, 18 };
char *name, fname[30];
char names[21][10] =
{ "ALBERTO", "BERYL", "CHRIS", "DEBBY", "ERNESTO", "FLORENCE", "GORDON",
"HELENE", "ISAAC", "JOYCE", "KIRK", "LESLIE", "MICHAEL", "NADINE",
"OSCAR", "PATTY", "RAFAEL", "SANDY", "TONY", "VALERIE", "WILLIAM" };
if (argc < 3)
{
fprintf(stderr, "Error: Enter a number of hurricanes and a number of files.\n");
fprintf(stderr, "The number of hurricanes should be a multiple of both 1024\nand the number of files.\n");
exit(0);
}
total_canes = atoi(argv[1]);
num_files = atoi(argv[2]);
total_canes = ((total_canes+1023)/1024) * 1024; // round up to multiple of 1024
canes = (total_canes + num_files - 1) / num_files; // round up (ceiling division)
total_canes = canes * num_files;
srand(time(NULL));
for (j = 0; j < num_files; j++)
{
if (num_files == 1)
sprintf(fname, "cane%dk.db", total_canes / 1024);
else
sprintf(fname, "cane%dk_%d_%d.db", total_canes / 1024, num_files, j);
if ((fp = fopen(fname, "w")) == NULL)
{
fprintf(stderr, "Failed to open output file '%s'!\n", fname);
return -1;
}
for (i = 0; i < canes; i++)
{
year = 1950 + rand() % 55;
month = 1 + rand() % 12;
date = 1 + rand() % 28;
hour = hours[rand() % 4];
num = 1 + rand() % 28;
name = names[rand() % 21];
lat = ((float) (7 + rand() % 63))
+ ((float) rand() / (float) 0x7fffffff);
lon = ((float) (rand() % 358))
+ ((float) rand() / (float) 0x7fffffff);
speed = 10 + rand() % 155;
press = rand() % 900;
fprintf(fp, "%4d %2d %2d %2d %2d %-9s %5.1f %5.1f %4d %4d\n",
year, month, date, hour, num, name, lat, lon, speed, press);
}
fclose(fp);
}
printf("Generated %d hurricanes in %d file(s).\n", total_canes, num_files);
if (num_files == 1)
{
sprintf(fname, "list%dk.txt", total_canes / 1024);
fp = fopen(fname, "w");
fprintf(fp, "../../data/nn/cane%dk.db\n", total_canes / 1024);
}
else
{
sprintf(fname, "list%dk_%d.txt", total_canes / 1024, num_files);
fp = fopen(fname, "w");
for (int i = 0; i < num_files; i++)
fprintf(fp, "../../data/nn/cane%dk_%d_%d.db\n", total_canes / 1024, num_files, i);
}
fclose(fp);
printf( "File list written to %s.\n", fname );
return 0;
}

View File

@@ -237,12 +237,12 @@ int loadData(char *filename, std::vector<Record> &records,
locations.push_back(latLong);
records.push_back(record);
recNum++;
if (0 == (recNum % 500))
break;
/*if (0 == (recNum % 500))
break;*/
}
if (++q == 3)
break;
/*if (++q == 3)
break;*/
fclose(fp);
}
fclose(flist);
@@ -281,8 +281,8 @@ void findLowest(std::vector<Record> &records, float *distances, int numRecords,
int parseCommandline(int argc, char *argv[], char *filename, int *r, float *lat,
float *lng, int *q, int *t, int *p, int *d) {
int i;
// if (argc < 2) return 1; // error
strncpy(filename, "filelist.txt", 100);
if (argc < 2) return 1; // error
strncpy(filename,argv[1],100);
char flag;
for (i = 1; i < argc; i++) {