forked from dsrankin/HCAL_HLS4ML
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cpu_send.cpp
54 lines (41 loc) · 1.41 KB
/
cpu_send.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <string>
#include <math.h>
#include <thread>
#include <chrono>
#include <string>
#include "galapagos_net_tcp.hpp"
#include "galapagos_node.hpp"
#include "hls4ml_hcal.h"
#define NUM_KERNELS 3
std::shared_ptr<spdlog::logger> my_logger;
typedef ap_uint<64> T;
#define GALAPAGOS_PORT 7
int main(int argc, const char** argv){
my_logger = spdlog::basic_logger_mt("basic_logger", "send_log.txt");
#if LOG_LEVEL==0
spdlog::set_level(spdlog::level::off); // Set global log level to off
#elif LOG_LEVEL==1
spdlog::set_level(spdlog::level::info); // Set global log level to info
#elif LOG_LEVEL==2
spdlog::set_level(spdlog::level::debug); // Set global log level to debug
#endif
spdlog::flush_every(std::chrono::seconds(2));
my_logger->info("Starting Send");
std::vector <std::string> kern_info;
std::string source_ip_str("10.0.0.1");
std::string dest_ip_str("10.0.0.2");
kern_info.push_back(source_ip_str);
kern_info.push_back(dest_ip_str);
galapagos::net::tcp <T> my_tcp(
GALAPAGOS_PORT,
kern_info,
source_ip_str,
my_logger
);
std::vector < galapagos::external_driver<T> * > ext_drivers;
ext_drivers.push_back(&my_tcp);
galapagos::node <T> node(kern_info, source_ip_str, ext_drivers, my_logger);
node.add_kernel(0, kern_send);
node.start();
node.end();
}