Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2477 Discussions

Circuit Satisfiability problem by using Intel TBB

vickyvision2020
Beginner
552 Views
Hi,

I Vikas, Newbie in Intel TBB parallel programming, first time I have set develpoment set up for Intel TBB (Visula studio 2010+Intel Parallel studio).For your convinience I list out my queries as follows.

1.Both softwares are working fine(OpenMP programs are also running all right), I have activated Intel TBB library as well.
2.I have been trying to execute Circuit Satisfiabilty problem by using Intel TBB, accordingly I designded code(hard code for: 16 variable function..65536 combinations are there)
3.first I clicked on "Build solution"..Its working fine but when I am trying to execute it, it is showing one error "PDB file can not find"..I think this file is required in order to create exe file.

herewith posting complete code that I have designed. please refine it if required. and do guide me how could I execute this program succesfully.There might be some changes in my code as this is my first program.

source code:

#include

#include

#include

#include

#include "tbb/task_scheduler_init.h"

#include "tbb/tick_count.h"

#include "tbb/parallel_for.h"

#include "tbb/blocked_range.h"

using namespace tbb;

using namespace std;

static int NThread = 4;

//int n=65536;

#define EXTRACT_BIT(n,i) ((n&(1<

void check_circuit(int );

void parallelcheck_circuit(int a[],size_t d);

class CircuitSatisfiability

{

int *const number;//constant pointer to interger

public:

CircuitSatisfiability(int *num) : number(num){} //parameterized constructor

void operator()(const blocked_range& range)const

{

int *num=number;

for(size_t i=range.begin();i!=range.end();i++)

check_circuit( num);

}

};

void parallelcheck_circuit(int number[],size_t n)

{

parallel_for(tbb::blocked_range(0,n),CircuitSatisfiability(number),auto_partitioner());

}

void check_circuit(int n) //Its static CIRCUIT composed of AND OR NOT gates, and having 16 variables.

{

int v[16]; /*each element is a bit of 'z'*/

for(int i=0;i<16;i++)

v=EXTRACT_BIT(n,i);

if((v[0]||v[1])&&(!v[1]||!v[3])&&(v[2]||v[3])&&(!v[3]||!v[4])&&(v[4]||!v[5])&&(v[5]||!v[6])&&(v[5]||v[6])&&(v[6]||!v[15])&&(v[7]||!v[8])&& (!v[7]||!v[13])&& (v[8]||v[9])&& (v[8]||!v[9])&&(!v[9]||!v[10])&&

(v[9]||v[11])&&(v[10]||v[11])&&(v[12]||v[13])&&(v[13]||!v[14])&&(v[14]||v[15]))

{

printf("%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d\\n",v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],v[13],v[14],v[15]);

fflush(stdout);

}

}

int main(int argc ,char *argv[])

{

int Array[65536];

task_scheduler_init init;

printf("Combinations satisfied by Circuit-SAT\\n");

tick_count t0 = tick_count::now();

for( int i=0;i<65536;i++)

{

Array=i;

}

parallelcheck_circuit(Array,65536);

tick_count t1 = tick_count::now();

printf("Parallel code(%d Threads) and Total execution time is %.16f sec",NThread,(t1-t0).seconds());

return 0;

}

0 Kudos
2 Replies
Kirill_R_Intel
Employee
552 Views
Hi,

PDB files contain debug and symbol info required for debugging. They are generated along this executables. But if some external modules are used, pdb files for them should be fetched from somewhere.
What building environmet do you use? If Visual studio, you can check the following settings when building in debug mode:

1) Tools > Options > Debugging > Symbols > Symbol file (.pdb) locations
set "http://msdl.microsoft.com/download/symbols"
2) Project > Properties > Configuration Properties > C/C++ > General > Debug Information Format
set "Program Database (/Zi)"
3) Project > Properties > Configuration Properties > Linker > Debugging > Generate Debug Info
set "Yes (/DEBUG)"

This looks like not TBB problem, butbuilding environment problem. Also building in Release mode shouldn't have this issue.

Regards,
Kirill
0 Kudos
vickyvision2020
Beginner
552 Views
Hi Kirill,

Thanks a lot for your reply, I excuted that program succesfully.


Regards,

Vikas
0 Kudos
Reply