-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCuda_kernel.cuh
111 lines (85 loc) · 2 KB
/
Cuda_kernel.cuh
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#pragma once
#include <stdio.h>
#include <cuda_runtime.h>
#include <curand.h>
#include <assert.h>
#include <time.h>
#include <vector>
#include "Constant.h"
#include "Bot.h"
#include "Food.h"
#include <random>
#include <algorithm>
#include <list>
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/sort.h>
#include "InfoGraph.h"
#include "GraphGA.h"
#include "GraphModule.h"
struct ConstantStruct
{
int FOOD_MASS;
int GAME_HEIGHT;
int GAME_TICKS;
int GAME_WIDTH;
int INERTION_FACTOR;
int MAX_FRAGS_CNT;
int SPEED_FACTOR;
int TICKS_TIL_FUSION;
int VIRUS_RADIUS;
int VIRUS_SPLIT_MASS;
float VISCOSITY;
int RadiusOfView = 4;
int SUM_RESP_TIMEOUT;
int RESP_TIMEOUT;
int Depth;
int CrossMove;
int BotPopulationSize;
int VirusPopulationSize;
int FoodPopulationSize;
int FoodAddPopulationSize;
int FoodPAdd;
int GlobalTicks;
int DepthBotPopulation;
int DepthFoodPopulation;
int DepthAddFoodPopulation;
int radius;
int KoeffWall;
int KoefEnemyDanger;
int KoefEnemyEat;
int KoefEat;
int KoefVirus;
int Lkoef;
int xSetRight;
int xSetLeft;
int ySetTop;
int ySetDown;
int IdeaTick;
int IdeaShortTick;
int numberofSensors;
int numberofSensorshalf;
int numberofSensorsAll;
int angleStep;
int angleStepInit;
int WorldTick;
int ArrayDim;
int TopologySize;
int TopologyRNNSize;
};
struct argumentsRNN
{
float *outputs;
float *sums;
float *sumsContext;
float *NNweights;
float *MNweights;
float *neuronContext;
};
__device__ float Sigmoid(float x);
__device__ float Tanh(float x);
__device__ float SoftSignFunction(float xValue);
__host__ void InitBotList(std::vector<Bot>& BotList, std::vector<float>& Sector, Constant& ct);
__host__ void InitFoodList(std::vector<Food>& FoodList, Constant & ct);
__host__ void InitAddFoodList(std::vector<Food>& AddFoodList, Constant & ct);
void ComputeLSTM(Constant& constant);