Skip to content
Snippets Groups Projects
Commit 5a1378b4 authored by Kerékgyártó Márton's avatar Kerékgyártó Márton
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 278 additions and 0 deletions
all:
g++ spectrum_cpp/*.cpp -O3 -o spectrum.exe -lboost_iostreams -lfftw3
g++ -o max.exe -O3 max.cpp
Rscript -e 'install.packages("extRemes")'
for i in $(ls output32); do ./spectrum.exe output32/$i > spectrum32/$i; done;
for i in $(ls spectrum32); do ./max.exe spectrum32/$i >> distr32.txt; done;
#replace 0,0,0,0,0... with 1,0,0,0,..... or smth similar in distr32 and 64
#Rscript evdparallel.R
#paste <(ls spectrum32/ | cut -f 2-3 -d '_' | sed 's/_/ /g') <(cat evd32.txt) > evd32_indices.txt
#num_p num_n loc scale shape
for i in $(ls output64); do ./spectrum.exe output64/$i > spectrum64/$i; done;
for i in $(ls spectrum64); do ./max.exe spectrum64/$i >> distr64.txt; done;
#Rscript evdparallel.R
#paste <(ls spectrum64/ | cut -f 2-3 -d '_' | sed 's/_/ /g') <(cat evd64.txt) > evd64_indices.txt
maximums <- as.matrix(read.csv("distr32.txt", header = FALSE))[, 1:5000]
file.create("evd32.txt")
evdPars <- array(dim = c(dim(maximums)[1], 3))
for (i in seq_len(dim(maximums)[1])) {
print(i)
tmp <- extRemes::findpars(extRemes::fevd(maximums[i, ], type = "GEV", method = "Bayesian"))
evdPars[i, 1] <- as.numeric(tmp[1])
evdPars[i, 2] <- as.numeric(tmp[2])
evdPars[i, 3] <- as.numeric(tmp[3])
}
write.table(evdPars, file = "evd32.txt", row.names = FALSE, col.names = FALSE, append = TRUE)
maximums <- as.matrix(read.csv("distr32.txt", header = FALSE))[, 1:5000]
library(parallel)
file.create("evd32.txt")
cl <- makeCluster(6)
evdPars <- parApply(cl, maximums, 1, function(x) {
tmp <- t(extRemes::findpars(extRemes::fevd(x, type = "GEV", method = "Bayesian")))
return(c(as.numeric(tmp[1, 1]), as.numeric(tmp[1, 2]), as.numeric(tmp[1, 3])))
})
stopCluster(cl)
write.table(t(evdPars), file = "evd32.txt", row.names = FALSE, col.names = FALSE, append = TRUE)
#include "sstream"
#include <fstream>
#include <iostream>
#include <stdio.h>
#include "locale.h"
// std::locale::global(std::locale("en_US.UTF-8"));
int main(int argc, char **argv) {
std::string line;
std::ifstream myfile(argv[1]);
if (myfile.is_open()&&myfile.good()) {
while (getline(myfile, line)) {
double max = 0;
std::stringstream ss(line);
double d;
while (ss >> d) {
if (d > max) {
max = d;
}
}
std::cout << max << ",";
}
myfile.close();
std::cout << std::endl;
}
else
std::cout << "Unable to open file";
return 0;
}
\ No newline at end of file
generateSequence <- function(n) {
for (i in 0:n) {
for (j in 0) {
if (i + j <= n) {
if (32 == n) {
fileName <- paste(c("output32/32", i, j, ".txt"), collapse = "_")
}
if (16 == n) {
fileName <- paste(c("output16/16", i, j, ".txt"), collapse = "_")
}
if (64 == n) {
fileName <- paste(c("output64/64", i, j, ".txt"), collapse = "_")
}
file.create(fileName)
sequence <- array(dim = n)
if (i >= 1) {
for (k in 1:(i)) {
sequence[k] <- "K"
}
}
if (j >= 1) {
for (k in (i + 1):(i + j)) {
sequence[k] <- "D"
}
}
if (i + j != n) {
for (k in (i + j + 1):(n)) {
sequence[k] <- "A"
}
}
print(i)
print(j)
for (k in 1:5000) {
sequence <- permuter::fisher_yates(sequence)
write(">a", fileName, append = TRUE)
write(paste(sequence, collapse = ""), fileName, append = TRUE)
}
}
}
}
}
{ BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Attach, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All, FixNamespaceComments: false }
CompileFlags: # Tweak the parse settings, example directory given to show format
Add:
# - "-I=[folder]" # old answer
# - "-I[folder]"
"--include-directory=/opt/Xilinx/Vitis_HLS/2023.2/include"
# Ignore build output directory
/build
# Ignore object files and dependent files
.o
.d
#Ignore logs folder and log files
/logs
.log
#Ignore lock files
.lock
.bin
.pdi
.theia/
.peers.ini
.repo.yaml
.analyzer_session.json
output.txt
ftchargefpgahls/
vivado*
.vscode/
*.exe
tmp*
/ft_charge_cpp/.vs/ft_charge_cpp
/ft_charge_cpp/ft_charge_cpp/x64/Debug
/ft_charge_cpp/packages/fftw_339.3.3.9.202108273
/ft_charge_cpp/packages/boost.1.84.0
/ft_charge_cpp/ft_charge_cpp/x64/Release
/ft_charge_cpp/packages
/ft_charge_cpp/x64
/ftcharge_hls/.cache/
\ No newline at end of file
[
"/opt/Xilinx/platforms/2023.2"
]
\ No newline at end of file
[]
\ No newline at end of file
{
"workspaceRoot": "/home/kerma8/ft_charge_2024_new",
"mapping": {
"src/krnl/tw_r32.h": "ftcharge_hls",
"src/krnl/calcnps.h": "ftcharge_hls",
"src/tb/FST_Seq.cpp": "ftcharge_hls",
"src/tb/InputReader.h": "ftcharge_hls",
"src/krnl/tw_i32.h": "ftcharge_hls",
"src/tb/FourierAnalyzation.cpp": "ftcharge_hls",
"src/krnl/ChargeCorCalc.h": "ftcharge_hls",
"src/tb/OutputWriter.cpp": "ftcharge_hls",
"src/tb/OutputWriter.h": "ftcharge_hls",
"src/krnl/tw_s_r.h": "ftcharge_hls",
"src/krnl/output_dma.h": "ftcharge_hls",
"src/krnl/ft_charge_32_64.cpp": "ftcharge_hls",
"src/tb/ftcharge_cpp.cpp": "ftcharge_hls",
"src/tb/ChargeCorrelCalculation.h": "ftcharge_hls",
"src/krnl/fftmax.cpp": "ftcharge_hls",
"src/krnl/fft_streaming.cpp": "ftcharge_hls",
"src/krnl/input_dma.cpp": "ftcharge_hls",
"src/tb/InputReader.cpp": "ftcharge_hls",
"src/tb/EVD_Arrays.cpp": "ftcharge_hls",
"src/krnl/filterevd.h": "ftcharge_hls",
"src/krnl/tw_r64.h": "ftcharge_hls",
"src/tb/ChargeCorrelCalculationSource.cpp": "ftcharge_hls",
"src/krnl/output_dma.cpp": "ftcharge_hls",
"src/krnl/calcnps.cpp": "ftcharge_hls",
"src/tb/EVD_calculation.cpp": "ftcharge_hls",
"src/krnl/fft_streaming.h": "ftcharge_hls",
"src/krnl/evd_calc.h": "ftcharge_hls",
"src/krnl/tw_s_i.h": "ftcharge_hls",
"src/tb/FourierAnalyzation.h": "ftcharge_hls",
"src/krnl/fftmax.h": "ftcharge_hls",
"src/krnl/ft_charge_types.h": "ftcharge_hls",
"src/tb/EVD_Arrays.h": "ftcharge_hls",
"src/krnl/filterevd.cpp": "ftcharge_hls",
"src/krnl/tw_i64.h": "ftcharge_hls",
"src/krnl/ft_charge_32_64.h": "ftcharge_hls",
"src/tb/EVD_calculation.h": "ftcharge_hls",
"src/krnl/input_dma.h": "ftcharge_hls",
"src/krnl/ChargeCorCalc.cpp": "ftcharge_hls",
"src/tb/FST_Seq.h": "ftcharge_hls",
"src/krnl/evd_calc.cpp": "ftcharge_hls"
}
}
\ No newline at end of file
File added
File added
File added
File added
File added
File added
CC = g++
SRC_DIRS ?= ./src
BUILD_DIR ?= ./build
TARGET_EXEC ?= ../tb.exe
SRCS := $(shell find $(SRC_DIRS) -name '*.cpp' -or -name '*.c' -or -name '*.s')
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
# INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_DIRS := /opt/Xilinx/Vitis_HLS/2023.2/include
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
CPPFLAGS ?= $(INC_FLAGS) -MMD -MP
# CPPFLAGS += -fopenmp -std=c++11 -Wall -g
CPPFLAGS += -std=c++11 -Wall -O3 -g3
# LDFLAGS := -fopenmp -lfftw3_omp -lfftw3 -lm -lboost_iostreams
LDFLAGS := -lfftw3 -lm -lboost_iostreams
MKDIR_P ?= mkdir -p
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CC) $(OBJS) -o $@ $(LDFLAGS)
# assembly
$(BUILD_DIR)/%.s.o: %.s
$(MKDIR_P) $(dir $@)
$(AS) $(ASFLAGS) -c $< -o $@
# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
# c++ source
$(BUILD_DIR)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ft_charge_cpp", "ft_charge_cpp\ft_charge_cpp.vcxproj", "{DDBCD524-4569-41E2-8CEE-A698C5450FDE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DDBCD524-4569-41E2-8CEE-A698C5450FDE}.Debug|x64.ActiveCfg = Debug|x64
{DDBCD524-4569-41E2-8CEE-A698C5450FDE}.Debug|x64.Build.0 = Debug|x64
{DDBCD524-4569-41E2-8CEE-A698C5450FDE}.Debug|x86.ActiveCfg = Debug|Win32
{DDBCD524-4569-41E2-8CEE-A698C5450FDE}.Debug|x86.Build.0 = Debug|Win32
{DDBCD524-4569-41E2-8CEE-A698C5450FDE}.Release|x64.ActiveCfg = Release|x64
{DDBCD524-4569-41E2-8CEE-A698C5450FDE}.Release|x64.Build.0 = Release|x64
{DDBCD524-4569-41E2-8CEE-A698C5450FDE}.Release|x86.ActiveCfg = Release|Win32
{DDBCD524-4569-41E2-8CEE-A698C5450FDE}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {711BEC33-11CA-43E4-A069-7D15EBEF00A7}
EndGlobalSection
EndGlobal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment