cl_explore.h 2.02 KB
/*
 * cl_expore.h
 *
 *  Created on: 10/09/2019
 *      Author: pedro
 */

#ifndef SRC_KERNELS_CL_EXPLORE_H_
#define SRC_KERNELS_CL_EXPLORE_H_

#ifndef __OPENCL_VERSION__

#include <stddef.h>
#include <stdio.h>
#include "cl_aux_functions.h"
#include "cl_propagators.h"
#include "../utils/cl_syntax.h"

#else

#include "cl_aux_functions.c"
#include "cl_propagators.c"

#endif

#define CL_PRINT_CSP 0	// 1 to print the CSP as received in the device, 0 to not print

#include "../config.h"
#include "../domains.h"
#include "cl_constraints.h"
#include "cl_variables.h"
#include "cl_ttl.h"

#if CL_D_TYPE == CL_BITMAP
#include "cl_bitmaps.h"
#elif CL_D_TYPE == CL_INTERVAL
#include  "cl_intervals.h"
#endif

__kernel void explore( __global unsigned int* atoms, CL_INTS_MEM int* ints,
		__global DOMAIN_* backtrack1,

#if CL_USE_N_BUFFERS > 1
		__global DOMAIN_* backtrack2,
#endif
#if CL_USE_N_BUFFERS > 2
		__global DOMAIN_* backtrack3,
#endif
#if CL_USE_N_BUFFERS > 3
		__global DOMAIN_* backtrack4,
#endif

		__global int* generic_mem,
#if CL_CS_IGNORE
		__global char* cs_ignore_,
#endif

#if CL_WORK == CL_ONE || CL_WORK == CL_OPT
		__global DOMAIN_* domains,
#endif

		CL_VS_MEM VARS* vs, CL_CS_MEM cl_constr* cs,
		CL_MEMORY VARS_PROP* vs_prop, CL_MEMORY unsigned short* vs_id_to_prop

#if CL_D_TYPE == CL_BITMAP
		, CL_B_DS_MEM cl_bitmap* b_ds	// when using bitmaps, this array contains the original domains of all the CSP variables
#endif

#if CL_STATS == 1
		, __global unsigned long* stats	// if statistics should be collected
#endif

#if CL_N_DEVS > 1
		,
		__global unsigned long* props		// 1 per work-item for counting the number of propagations made by each work-item
#endif

#if CL_N_SHARED_SS > 0
		, __global DOMAIN_* shared_ss	// stores for work-sharing
		, __global int* shared_ss_flags
#endif

#if CL_FILTERING
		, __global DOMAIN_* filt_domains	// when filtering the CSP for the domains of the variables
		, __global char* filt_cs	// when filtering the CSP for the flag of ignoring constraints
#endif

		);

#endif /* SRC_KERNELS_CL_EXPLORE_H_ */