-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathour_parallel_functions.h
More file actions
139 lines (97 loc) · 3.74 KB
/
Copy pathour_parallel_functions.h
File metadata and controls
139 lines (97 loc) · 3.74 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <pthread.h>
#include "mmio.h"
#ifndef COLORING_AND_FIND_SCC
#define COLORING_AND_FIND_SCC
typedef unsigned int uint;
// Structure declaration
struct vector_pair {
uint vector_size; // Member (uint variable)
uint* vector1_start; // Member (uint* variable)
uint* vector2_start; // Member (uint* variable)
};
// Structure declaration
struct vector_part {
struct vector_pair v ; // Struct
uint start_of_the_part ;
uint end_of_the_part ;
};
struct color_propagation_data{
bool* has_changed_colors_forward ;
bool* has_changed_colors_backward ;
uint E ;
bool* is_in_SCC ;
uint* v;
uint* v_back;
uint* I;
uint* J;
};
struct color_propagation_data_part{
struct color_propagation_data data ;
uint start_for ;
uint end_for ; // less than E
};
struct my_bool_arrays_struct {
bool* is_in_SCC;
uint* SCC_colors;
bool* is_it_root;
};
struct are_in_scc_data_part{
struct vector_pair v ;
struct my_bool_arrays_struct bool_arrays ;
uint start_for;
uint end_for ;
bool* is_G_not_empty; // pointer not array !
};
struct trim_data{
bool* is_in_I;
bool* is_in_J;
bool* is_in_SCC;
bool* is_it_root;
uint* I ;
uint* J ;
};
struct trim_data_part{
struct trim_data same_data_for_all_threads ;
uint start_for_over_E ;
uint end_for_over_E ;
uint start_for_over_nodes ;
uint end_for_over_nodes ;
};
union parfor_inputs {
struct vector_part coloring_initialization ;
struct color_propagation_data_part color_propagation ;
struct are_in_scc_data_part find_scc_data ;
struct trim_data_part trim_input ;
};
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Forward Declarations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int parfor( pthread_t* threads , int total_number_of_threads, void* (some_parallel_funtion)(void*) , union parfor_inputs* thread_input);
//void* parfor( pthread_t* threads , int total_number_of_threads, void* (some_parallel_funtion)(void*) , void* thread_input , int thread_input_element_size);
void* parfor_test( pthread_t* threads , int total_number_of_threads, void* (some_parallel_funtion)(void*) , void* thread_input , int thread_input_element_size);
void* initialize_colors_parallel( void* v_part);
void* forward_color_propagation( void* input );
void* backward_color_propagation( void* input );
void* parallel_forward_and_backward_color_propagation( void* input );
void* find_SCC ( void* input);
void* count_SCC ( void* input);
int parallel_trim(pthread_t* threads , int number_of_threads , void* input ) ;
void* check_if_IorJ (void* input ) ;
void* actual_parallel_trim ( void* input);
void* initialize_to_false_is_in_IandJ ( void* input);
void trim_serial( uint* I , uint* J ,bool* is_in_I , bool* is_in_J , bool* is_in_SCC , bool* is_it_root, uint E , uint total_nodes, int* total_nodes_in_SCC);
// That is the old serial one
//void initialize_colors(uint *v, uint *v_back, uint size_of_V);
void print_array(uint *v, uint size_of_V);
void print_edges(uint *I, uint *J, uint E);
// bool is_it_in_this_vector(uint *vector, uint size_of_vector,
// uint element_we_search, bool is_the_vector_sorted);
void load_file(const char *file_name, uint *total_nodes,
uint *total_number_of_edges, uint **I, uint **J, int number_of_columns) ;
void load_example(uint *total_nodes, uint *total_number_of_edges, uint **I,
uint **J);
const char* select_file(int number_of_file);
int number_columns(int number_of_file);
#endif