chore: init

This commit is contained in:
2025-09-19 15:36:37 +02:00
commit 9d707a253a
2190 changed files with 17598 additions and 0 deletions

79
Student_OMP/.project Executable file
View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Tuto_Graphe_GL</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>-f mingw.mk</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>false</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/Aleas.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/01_namespace_cpu/Animator_CPU.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/06_context/Args.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/03_array/Array.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/03_array/Array_Imp.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/Bandwidth.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/01_namespace_cpu/Calibreur_CPU.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/Chrome.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/05_chrono/Chrono.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/05_chrono/clock/ChronoClock.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/05_chrono/ChronoFactory.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/05_chrono/omp/ChronoOMP.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/05_chrono/std/ChronoSTD.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/05_chrono/ChronoType.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/ColorRGB_01.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/01_namespace_cpu/Colors_CPU.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/Couts.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/extension/CppTest.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/05_chrono/EtatChrono.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/04_files/Folders.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/Fps.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/FpsCalculator.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/01_namespace_cpu/Indices_CPU.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/01_namespace_cpu/Interval_CPU.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/Iterator.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/Limits.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/Maths.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_omp/305_016/INC/OMP_Tools/Omps.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_omp/305_016/INC/OMP_Tools/ParallelPatern.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/Progress.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/04_files/ResultWritter.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/Runnable_I.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/Strings.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/03_array/Tab.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/03_array/TabTools.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/03_array/Tab_Imp.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/01_namespace_cpu/Variateur_CPU.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/header/VideoShop.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/config.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest-assert.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest-collectoroutput.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest-compileroutput.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest-htmloutput.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest-output.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest-source.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest-suite.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest-textoutput.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/cpptest-time.h

View File

@@ -0,0 +1 @@
/opt/api/cbi/tools/bilat_tools_cpp/305_016/INC/tools/02_fps/01_namespace_cpu/cudaType_CPU.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/missing.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/extension/outputType.h

View File

@@ -0,0 +1 @@
/opt/api/ext/cpptest/200/INC/utils.h

View File

@@ -0,0 +1 @@
/home/mse15/CUDA/toStudent/code/WCudaStudent/Student_OMP/src/core/omp/02_Slice/99_pi_tools.h

View File

@@ -0,0 +1 @@
/home/mse15/CUDA/toStudent/code/WCudaStudent/Student_OMP/src/test/unit/01_Test_Hello/TestHello.h

View File

@@ -0,0 +1 @@
/home/mse15/CUDA/toStudent/code/WCudaStudent/Student_OMP/src/test/unit/02_Test_Pi/TestPi.h

75
Student_OMP/dataProject.mk Executable file
View File

@@ -0,0 +1,75 @@
# Version 0.0.2
# Cedric.Bilat@he-arc.ch
#
# Notes:
#
# (N1) This configuration file is compiler-free.
#
# (N2) Go in xxx.mk if you whish customize a specific compiler (where xxx= gcc, xxx = visual, ...).
#
# Conseils:
#
# (C1) In the below definition of variables, never let a space at the end!!!
#
# (C2) When you overrid a varaible "XXX+= YYY" be careful to let a space after the symbol "="
#
#################################################
# Project Configurator #
#################################################
##############################
# Basic #
##############################
#Name target (without extension)
TARGET_NAME:=Student_OMP_${USER}
#Target type:
# EXE
# SHARED_LIB
# STATIC_LIB
TARGET_MODE:=EXE
#################
# src aux #
#################
# Expand the src folder.
# Tip : All files (.cpp, .h .lib, ...) will be considered recursively !
# Mimimum : empty
override SRC_AUX+=#
#################
# API Ext #
#################
# Define preconfigured extern API
# Tip : See ../PRODUCTION/....../api for available preconfigured api (Boost, openCV, cppTest, ...)
# Note : apiXXX.mk define
# .h for compil-time
# .so .lib for link-time
# but nothing usefull for runtime
# Usage : -include $(API)/XXX.mk
# Mimimum : empty
include $(API_CBI_TOOLS)/bilat_tools_cpp.mk
include $(API_CBI_TOOLS)/bilat_tools_omp.mk
include $(API_EXT)/cppTest.mk
#############################
# Advanced #
#############################
# Define compilation variable
# Note : Same as -DXXX (on command line) or #define XXX (in .ccp code)
# Mimimum : empty
override CODE_DEFINE_VARIABLES+=#
#################################################
# End #
#################################################

View File

@@ -0,0 +1,51 @@
#include <stdlib.h>
#include <iostream>
#include "ChronoFactory.h"
using std::cerr;
using std::cout;
using std::endl;
/*--------------------------------------*\
|* Imported *|
\*-------------------------------------*/
extern bool usePI();
extern bool useHello();
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
int mainCore()
{
Chrono* ptrChrono = ChronoFactory::create();
bool isOk = true;
isOk &= useHello();
isOk &= usePI();
ptrChrono->stop();
cout << endl << endl;
cout << "mainCore :" << *ptrChrono << endl;
cout << "mainCore : ";
if (isOk)
{
cout << "SUCCESS, Congratulation!";
}
else
{
cerr << "FAILED, sorry!";
}
cout << endl << endl;
delete ptrChrono;
return isOk ? EXIT_SUCCESS : EXIT_FAILURE;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,51 @@
#include <iostream>
#include <stdio.h>
#include "omp.h"
#include "Omps.h"
using std::cout;
using std::endl;
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
void helloOMP1()
{
cout << endl << "[HelloOMP 1]" << endl;
// OMP (facultatif)
const int NB_THREAD = Omps::setAndGetNaturalGranularity();
cout << "\n[HELLO] nbThread = " << NB_THREAD << endl;
#pragma omp parallel
{
int tid = Omps::getTid();
//cout << "tid=" << tid << endl; // ligne couper
printf("tid=%i\n", tid); //ligne non couper
}
}
void helloOMP2()
{
cout << endl << "[HelloOMP 2]" << endl;
// OMP (facultatif)
const int NB_THREAD = Omps::setAndGetNaturalGranularity();
cout << "\n[CBI] nbThread = " << NB_THREAD << endl;
int n = 20;
#pragma omp parallel for
for (int i = 1; i <= n; i++)
{
//cout << "HelloOMP(" << i << ")" << endl; // ligne couper
printf("HelloOMP(%i)\n", i); // ligne non couper
}
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,30 @@
#include <iostream>
using std::cout;
using std::endl;
/*--------------------------------------*\
|* Imported *|
\*-------------------------------------*/
extern void helloOMP1();
extern void helloOMP2();
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
bool useHello()
{
cout << endl << "[HelloOMP]" << endl;
helloOMP1();
helloOMP2();
return true;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,49 @@
#include "99_pi_tools.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiSequentiel_OK(int n);
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
static double piSequentiel(int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiSequentiel_OK(int n)
{
return isAlgoPI_OK(piSequentiel, n, "Pi Sequentiel");
}
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
double piSequentiel(int n) {
const double delta_x = 1 / (double)n;
double sum = 0;
for (int i = 0; i < n; i++) {
double xi = i * delta_x;
sum += fpi(xi);
}
return sum * delta_x;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,77 @@
#include <omp.h>
#include "Omps.h"
#include "99_pi_tools.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPEntrelacerPromotionTab_Ok(int n);
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
static double piOMPEntrelacerPromotionTab(int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPEntrelacerPromotionTab_Ok(int n)
{
return isAlgoPI_OK(piOMPEntrelacerPromotionTab, n, "Pi OMP Entrelacer promotionTab");
}
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
/**
* pattern cuda : excellent!
*/
double piOMPEntrelacerPromotionTab(int n)
{
const double delta_x = 1.0 / (double)n;
const int NB_THREAD = Omps::setAndGetNaturalGranularity();
double sum[NB_THREAD];
// Reduction intra thread
#pragma omp parallel
{
const int TID = Omps::getTid();
int s = TID;
double sum_thread = 0;
while (s < n)
{
double xi = s * delta_x;
sum_thread += fpi(xi);
s += NB_THREAD;
}
sum[TID] = sum_thread;
}
double sumTotal = 0;
for (int i = 0; i < NB_THREAD; i++)
{
sumTotal += sum[i];
}
return sumTotal * delta_x;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,47 @@
#include <omp.h>
#include "Omps.h"
#include "99_pi_tools.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPEntrelacerCritical_Ok(int n);
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
static double piOMPEntrelacerCritical(int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPEntrelacerCritical_Ok(int n)
{
return isAlgoPI_OK(piOMPEntrelacerCritical, n, "Pi OMP Entrelacer critical");
}
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
double piOMPEntrelacerCritical(int n)
{
//TODO
return -1;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,50 @@
#include <omp.h>
#include "Omps.h"
#include "99_pi_tools.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPEntrelacerAtomic_Ok(int n);
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
static double piOMPEntrelacerAtomic(int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPEntrelacerAtomic_Ok(int n)
{
return isAlgoPI_OK(piOMPEntrelacerAtomic, n, "Pi OMP Entrelacer atomic");
}
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
/**
* Bonne performance, si!
*/
double piOMPEntrelacerAtomic(int n)
{
// TODO
return -1;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,50 @@
#include <omp.h>
#include "Omps.h"
#include "99_pi_tools.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPforCritical_Ok(int n);
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
static double piOMPforCritique(int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPforCritical_Ok(int n)
{
return isAlgoPI_OK(piOMPforCritique, n, "Pi OMP for critique");
}
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
/**
* synchronisation couteuse!
*/
double piOMPforCritique(int n)
{
//TODO
return -1;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,50 @@
#include <omp.h>
#include "Omps.h"
#include "99_pi_tools.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPforAtomic_Ok(int n);
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
static double piOMPforAtomic(int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPforAtomic_Ok(int n)
{
return isAlgoPI_OK(piOMPforAtomic, n, "Pi OMP for atomic");
}
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
/**
* synchronisation couteuse!
*/
double piOMPforAtomic(int n)
{
//TODO
return -1;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,53 @@
#include <omp.h>
#include "Maths.h"
#include "Omps.h"
#include "99_pi_tools.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPforPromotionTab_Ok(int n);
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
static double piOMPforPromotionTab(int n);
static void syntaxeSimplifier(double* tabSumThread , int n);
static void syntaxeFull(double* tabSumThread , int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPforPromotionTab_Ok(int n)
{
return isAlgoPI_OK(piOMPforPromotionTab, n, "Pi OMP for promotion tab");
}
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
/**
* De-synchronisation avec PromotionTab
*/
double piOMPforPromotionTab(int n)
{
//TODO
return -1;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,51 @@
#include <omp.h>
#include "Omps.h"
#include "99_pi_tools.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPforReduction_Ok(int n);
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
static double piOMPforReduction(int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
bool isPiOMPforReduction_Ok(int n)
{
return isAlgoPI_OK(piOMPforReduction, n, "Pi OMP for reduction-integrer");
}
/*--------------------------------------*\
|* Private *|
\*-------------------------------------*/
/**
* pattern omp usefull : idem desyncronisation-promotionTab ,mais avec syntaxe plus courte!
* Si on enleve le pragma, le code est le meme que le sequentiel!
*/
double piOMPforReduction(int n)
{
//TODO
return -1;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,47 @@
#include "99_pi_tools.h"
#include <iostream>
#include "ChronoFactory.h"
#include "Maths.h"
using std::cout;
using std::endl;
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
double fpi(double x)
{
return 4 / (1 + x * x);
}
bool isAlgoPI_OK(AlgoPI algoPI , int n , string title)
{
cout << endl << endl << "[" << title << " running ...]" << endl;
cout << "\tn=" << n << endl;
Chrono* ptrChrono = ChronoFactory::create();
double piHat = algoPI(n);
ptrChrono->stop();
cout.precision(8);
cout << "\tPi hat = " << piHat << endl;
cout << "\tPi true = " << PI << endl;
bool isOk = Maths::isEquals(piHat, PI, 1e-6);
cout << "\tisOk = " << isOk << endl;
cout.precision(3);
cout<<"\ttime : "<<*ptrChrono<<endl;
cout << endl;
delete ptrChrono;
return isOk;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,25 @@
#pragma once
#include <string>
using std::string;
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
// ptr fonction de type double xxx(int n)
// ou xxx sera une methode de calcul de pi
typedef double (*AlgoPI)(int);
/*--------------------------------------*\
|* Methode *|
\*-------------------------------------*/
double fpi(double x);
bool isAlgoPI_OK(AlgoPI algoPI, int n, string title);
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,46 @@
#include <iostream>
#include <limits.h>
using std::cout;
using std::endl;
/*--------------------------------------*\
|* Imported *|
\*-------------------------------------*/
extern bool isPiSequentiel_OK(int n);
extern bool isPiOMPEntrelacerPromotionTab_Ok(int n);
extern bool isPiOMPEntrelacerCritical_Ok(int n);
extern bool isPiOMPEntrelacerAtomic_Ok(int n);
extern bool isPiOMPforCritical_Ok(int n);
extern bool isPiOMPforAtomic_Ok(int n);
extern bool isPiOMPforPromotionTab_Ok(int n);
extern bool isPiOMPforReduction_Ok(int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
bool usePI()
{
cout << endl << "[PI]" << endl;
int n = INT_MAX / 10;
bool isOk = true;
isOk &= isPiSequentiel_OK(n);
isOk &= isPiOMPEntrelacerPromotionTab_Ok(n);
isOk &= isPiOMPEntrelacerCritical_Ok(n);
isOk &= isPiOMPEntrelacerAtomic_Ok(n);
isOk &= isPiOMPforCritical_Ok(n);
isOk &= isPiOMPforAtomic_Ok(n);
isOk &= isPiOMPforPromotionTab_Ok(n);
isOk &= isPiOMPforReduction_Ok(n);
return isOk;
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

46
Student_OMP/src/main.cpp Executable file
View File

@@ -0,0 +1,46 @@
#include <iostream>
#include <limits.h>
#include "Limits.h"
using std::cout;
using std::endl;
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Imported *|
\*-------------------------------------*/
extern int mainCore(void);
extern int mainTest(void);
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
int main(void);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\
|* Public *|
\*-------------------------------------*/
int main(void)
{
cout << "main" << endl;
Limits::rappelTypeSize();
const bool IS_TEST = false;
return IS_TEST ? mainTest() : mainCore();
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,44 @@
#include <stdlib.h>
#include <iostream>
#include "CppTest.h"
#include "Folders.h"
#include "TestHello.h"
#include "TestPi.h"
#include "Chrome.h"
using std::cout;
using std::endl;
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
int mainTest()
{
Test::Suite testSuite;
testSuite.add(std::auto_ptr < Test::Suite > (new TestHello()));
testSuite.add(std::auto_ptr < Test::Suite > (new TestPi()));
// run
{
string folder = "./out";
string title = "testAll";
string fileHTML = title + ".html";
Folders::mkdirP(folder);
int result = CppTest::run(folder, fileHTML, title, testSuite, OutputType::HTML); // HTML CONSOLE
Chrome::showHTML(folder, fileHTML); // to be commented if OutputType::CONSOLE
return result;
}
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,34 @@
#include "TestHello.h"
/*--------------------------------------*\
|* Imported *|
\*-------------------------------------*/
extern void helloOMP1();
extern void helloOMP2();
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
TestHello::TestHello()
{
TEST_ADD(TestHello::testHelloOMP1);
TEST_ADD(TestHello::testHelloOMP2);
}
void TestHello::testHelloOMP1()
{
helloOMP1();
}
void TestHello::testHelloOMP2()
{
helloOMP2();
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,25 @@
#pragma once
#include "cpptest.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
class TestHello: public Test::Suite
{
public:
TestHello();
private:
void testHelloOMP1();
void testHelloOMP2();
};
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,80 @@
#include "TestPi.h"
#include <limits.h>
/*--------------------------------------*\
|* Imported *|
\*-------------------------------------*/
extern bool isPiSequentiel_OK(int n);
extern bool isPiOMPEntrelacerPromotionTab_Ok(int n);
extern bool isPiOMPEntrelacerCritical_Ok(int n);
extern bool isPiOMPEntrelacerAtomic_Ok(int n);
extern bool isPiOMPforCritical_Ok(int n);
extern bool isPiOMPforAtomic_Ok(int n);
extern bool isPiOMPforPromotionTab_Ok(int n);
extern bool isPiOMPforReduction_Ok(int n);
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
TestPi::TestPi()
{
this->n = INT_MAX / 10;
TEST_ADD(TestPi::testSequentiel);
TEST_ADD(TestPi::testEntrelacerPromotionTab);
TEST_ADD(TestPi::testEntrelacerAtomic);
TEST_ADD(TestPi::testEntrelacerCritical);
TEST_ADD(TestPi::testAtomic);
TEST_ADD(TestPi::testCritical);
TEST_ADD(TestPi::testPromotionTab);
TEST_ADD(TestPi::testForReduction);
}
void TestPi::testSequentiel()
{
TEST_ASSERT(isPiSequentiel_OK(n) == true);
}
void TestPi::testEntrelacerPromotionTab()
{
TEST_ASSERT(isPiOMPEntrelacerPromotionTab_Ok(n) == true);
}
void TestPi::testEntrelacerAtomic()
{
TEST_ASSERT(isPiOMPEntrelacerAtomic_Ok(n) == true);
}
void TestPi::testEntrelacerCritical()
{
TEST_ASSERT(isPiOMPEntrelacerCritical_Ok(n) == true);
}
void TestPi::testCritical()
{
TEST_ASSERT(isPiOMPforCritical_Ok(n) == true);
}
void TestPi::testAtomic()
{
TEST_ASSERT(isPiOMPforAtomic_Ok(n) == true);
}
void TestPi::testPromotionTab()
{
TEST_ASSERT(isPiOMPforPromotionTab_Ok(n) == true);
}
void TestPi::testForReduction()
{
TEST_ASSERT(isPiOMPforReduction_Ok(n) == true);
}
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/

View File

@@ -0,0 +1,35 @@
#pragma once
#include "cpptest.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
class TestPi: public Test::Suite
{
public:
TestPi(void);
private:
void testSequentiel();
void testEntrelacerPromotionTab();
void testEntrelacerAtomic();
void testEntrelacerCritical();
void testCritical();
void testAtomic();
void testPromotionTab();
void testForReduction();
private:
int n;
};
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/