Blame view

src/split.h 1.59 KB
94b2b13d   Pedro Roque   PHACT source
1
2
3
4
/*
 * split.h
 *
 *  Created on: 19/02/2015
4d26a735   Pedro Roque   Increased recogni...
5
 *      Author: pedro
94b2b13d   Pedro Roque   PHACT source
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 */

#ifndef SRC_SPLIT_H_
#define SRC_SPLIT_H_

#include <stdbool.h>

#include "CL/cl.h"
#include "CL/cl_platform.h"

#include "devices.h"
#include "kernels/cl_constraints.h"
#include "kernels/cl_variables.h"
#include "config.h"

typedef struct platf_args {
4d26a735   Pedro Roque   Increased recogni...
22
23
	cl_platform_id platform_id;	// platform ID
	cl_uint n_devs;	// Number of devices on this platform
94b2b13d   Pedro Roque   PHACT source
24
25
26
} platf_args;

typedef struct threads_data {
4d26a735   Pedro Roque   Increased recogni...
27
	unsigned int depth;	// Tree expansion depth needed to get n_ss disjoint search spaces
94b2b13d   Pedro Roque   PHACT source
28
	unsigned int n_ss;		// Number of sub-search spaces created
4d26a735   Pedro Roque   Increased recogni...
29
30
31
32
33
34
	unsigned int* next_str;	// Index in stores where the next unexplored sub-search space is placed (atomic read and write)
	cl_uint* val_to_opt;	// Max value on the domain of the variable to optimize (atomic read and write)
	unsigned char* sol_found;	// To set to 1 when only one solution is wanted and is found (atomic read and write)
	device_info* dev_info;	// Information about the device to use
	device_args* dev_args;	// Device arguments (buffers, etc.)
	platf_args* platform_args;	// All platforms info
94b2b13d   Pedro Roque   PHACT source
35
	unsigned int dev_number;	// Number of this device on dev_info
4d26a735   Pedro Roque   Increased recogni...
36
	bool local;	// If local memory of each device should be used
94b2b13d   Pedro Roque   PHACT source
37
38
39
40
41
} threads_data;

cl_ulong solve_CSP();
bool filter_CSP();

4d26a735   Pedro Roque   Increased recogni...
42
void* solve_on_device(void* thread_arg);
94b2b13d   Pedro Roque   PHACT source
43

4d26a735   Pedro Roque   Increased recogni...
44
45
void set_next_block_size(device_info* dev_info, unsigned int dev_idx, unsigned int n_ss, unsigned int* last_str_explored);
void split_ss(unsigned int* depth, unsigned int* n_ss, unsigned int n_vs_to_label);
94b2b13d   Pedro Roque   PHACT source
46
47

#endif /* SRC_SPLIT_H_ */