Changeset 116
- Timestamp:
- Jan 13, 2010, 8:04:18 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
proiecte/Parallel-DT/R8/Src/build.c
r109 r116 410 410 /* For each available attribute, find the information and gain */ 411 411 /* THIS MUST BE PARALELIZED */ 412 #pragma omp parallel shared(Possible, AvGain) private(thread_id, Att)412 #pragma omp parallel if(Lp-Fp > 1000) shared(Possible, AvGain) private(thread_id) 413 413 { 414 #pragma omp for private(Att) reduction(+:Possible, AvGain) 415 ForEach(Att, 0, MaxAtt) { 416 Gain[Att] = -Epsilon; 417 418 if (SpecialStatus[Att] == IGNORE) 419 continue; 420 421 if (MaxAttVal[Att]) { 422 /* discrete valued attribute */ 423 424 if (SUBSET && MaxAttVal[Att] > 2) { 425 EvalSubset(Att, Fp, Lp, Cases); 426 } else if (!Tested[Att]) { 427 thread_id = omp_get_thread_num(); 428 EvalDiscreteAtt_Discr(Att, Fp, Lp, Cases, Freq_discr[thread_id], 429 ValFreq_discr[thread_id], UnknownRate_discr[thread_id], &Gain[Att], &Info[Att]); 414 415 #pragma omp for private(Att) schedule(static) reduction(+:Possible, AvGain) 416 417 ForEach(Att, 0, MaxAtt) { 418 Gain[Att] = -Epsilon; 419 420 if (SpecialStatus[Att] == IGNORE) 421 continue; 422 423 if (MaxAttVal[Att]) { 424 /* discrete valued attribute */ 425 426 if (SUBSET && MaxAttVal[Att] > 2) { 427 EvalSubset(Att, Fp, Lp, Cases); 428 } else if (!Tested[Att]) { 429 thread_id = omp_get_thread_num(); 430 //printf("thread_id = %d\n", thread_id); 431 EvalDiscreteAtt_Discr(Att, Fp, Lp, Cases, Freq_discr[thread_id], 432 ValFreq_discr[thread_id], UnknownRate_discr[thread_id], &Gain[Att], &Info[Att]); 433 } 434 } else { 435 /* continuous attribute */ 436 EvalContinuousAtt(Att, Fp, Lp); 430 437 } 431 } else { 432 /* continuous attribute */ 433 EvalContinuousAtt(Att, Fp, Lp); 434 } 435 436 /* Update average gain, excluding attributes with very many values */ 437 438 if (Gain[Att] > -Epsilon && (MultiVal || MaxAttVal[Att] < 0.3 * (MaxItem + 1))){ 439 //#pragma omp atomic 440 Possible++; 441 442 //#pragma omp atomic 443 AvGain += Gain[Att]; 444 } 445 446 } 438 439 /* Update average gain, excluding attributes with very many values */ 440 441 if (Gain[Att] > -Epsilon && (MultiVal || MaxAttVal[Att] < 0.3 * (MaxItem + 1))){ 442 //#pragma omp atomic 443 Possible++; 444 445 //#pragma omp atomic 446 AvGain += Gain[Att]; 447 } 448 449 } 450 447 451 } 448 452 … … 530 534 } 531 535 532 Node->Branch[v] = FormTree (Fp, Ep);536 Node->Branch[v] = FormTree_Discr(Fp, Ep); 533 537 Node->Errors += Node->Branch[v]->Errors; 534 538
Note: See TracChangeset
for help on using the changeset viewer.