DotMP
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
DotMPTests.CPUTests Class Reference

CPU tests for the DotMP library. More...

Public Member Functions

 CPUTests (ITestOutputHelper output)
 Constructor to write output. More...
 
void Parallel_performance_should_be_higher ()
 Tests to make sure that parallel performance is higher than sequential performance. More...
 
void Parallel_should_work ()
 Tests to make sure that DotMP.Parallel.ParallelRegion()'s are actually created. More...
 
void Parallelfor_should_work ()
 Tests the functionality of DotMP.Parallel.For(). More...
 
void Guided_should_produce_correct_results ()
 Tests to make sure that DotMP.Schedule.Guided produces correct results. More...
 
void Workstealing_should_produce_correct_results ()
 Tests to make sure that DotMP.Schedule.Guided produces correct results. More...
 
void Workstealing_load_balances ()
 Tests to ensure that workstealing adequately load balances. More...
 
void Static_should_produce_correct_results ()
 Tests to make sure that DotMP.Schedule.Static produces correct results. More...
 
void Dynamic_should_produce_correct_results ()
 Tests to make sure that DotMP.Schedule.Dynamic produces correct results. More...
 
void Collapse_works ()
 Tests to make sure that DotMP.Parallel.ForCollapse produces correct results. More...
 
void Reduction_collapse_works ()
 Tests to make sure that DotMP.Parallel.ForReductionCollapse produces correct results. More...
 
void Taskloop_should_produce_correct_results ()
 Tests to make sure that taskloops produce correct results. More...
 
void Taskloop_dependencies_work ()
 Tests taskloop dependencies, and in turn, more complex dependency chaining. More...
 
void Nested_task_dependencies_work ()
 Ensures that nested task dependencies work. More...
 
void Schedule_runtime_works ()
 Tests to make sure that DotMP.Parallel.Schedule.Runtime properly reads values from the environment variable. More...
 
void Critical_works ()
 Tests to make sure that DotMP.Parallel.Critical() works. More...
 
void Master_works ()
 Tests to make sure that DotMP.Parallel.Master() works. More...
 
void Single_works ()
 Tests to make sure that DotMP.Parallel.Single() works. More...
 
void Atomic_works ()
 Tests to make sure that the DotMP.Atomic class works. More...
 
void Ordered_works ()
 Tests to make sure that DotMP.Parallel.Ordered() works. More...
 
void Reduction_works ()
 Tests to make sure that DotMP.Parallel.ForReduction<T>() works. More...
 
void Get_and_Set_NumThreads_work ()
 Tests to make sure that DotMP.Parallel.SetNumThreads() works. More...
 
void InParallel_works ()
 Tests to make sure that DotMP.Parallel.InParallel() works. More...
 
void SetDynamic_works ()
 Tests to make sure that DotMP.Parallel.SetDynamic() works. More...
 
void GetWTime_works ()
 Tests to make sure that DotMP.Parallel.GetWTime() works. More...
 
void GetNested_works ()
 Tests to make sure that DotMP.Parallel.GetNested() and DotMP.Parallel.SetNested() work. More...
 
void Locks_work ()
 Tests to make sure that the DotMP.Locking and DotMP.Lock classes work. More...
 
void Shared_works ()
 Tests to make sure the DotMP.Shared class works. More...
 
void SharedEnumerable_works ()
 Tests to make sure the DotMP.SharedEnumerable class works. More...
 
void Sections_works ()
 Tests to make sure that DotMP.Parallel.Sections() and DotMP.Parallel.Section() work. More...
 
void Tasking_works ()
 Tests to see if the basics of tasking work. More...
 
void Taskloop_only_if_works ()
 Test if the only_if clause works on taskloops. More...
 
void Nested_tasks_work ()
 Checks to see if nested tasks work. More...
 
void Task_dependencies_work ()
 Test if taskloop dependencies work. More...
 
void Non_parallel_for_should_except ()
 Verifies that a Parallel.For used outside of a parallel region throws an exception. More...
 
void Nested_parallelism_should_except ()
 Verifies that nested parallelism throws an exception. More...
 
void Non_parallel_sections_should_except ()
 Verifies that a sections region used outside of a parallel region throws an exception. More...
 
void Non_parallel_barrier_should_except ()
 Verifies that a barrier used outside of a parallel region throws an exception. More...
 
void Non_parallel_master_should_except ()
 Verifies that a master region used outside of a parallel region throws an exception. More...
 
void Non_parallel_single_should_except ()
 Verifies that a single region used outside of a parallel region throws an exception. More...
 
void Non_parallel_critical_should_except ()
 Verifies that a critical region used outside of a parallel region throws an exception. More...
 
void Nested_worksharing_should_except ()
 Verifies that nested worksharing throws an exception. More...
 
void Non_for_ordered_should_except ()
 Verifies that an ordered region used outside of a for region throws an exception. More...
 
void Non_parallel_GetThreadNum_should_except ()
 Verifies that GetThreadNum used outside of a parallel region throws an exception. More...
 
void Absent_params_shouldnt_except ()
 Verifies that absent parameters shouldn't throw exceptions. More...
 
void Overflow_for_should_except ()
 Verifies that for loops which overflow internal indices should throw an exception. More...
 
void Invalid_params_should_except ()
 Verifies that invalid parameters throw exceptions. More...
 
void Custom_scheduler_works ()
 Verifies that custom schedulers work. More...
 
void Nested_taskwait_works ()
 Checks that nested taskwait works. More...
 
void Improper_taskwait_should_except ()
 Ensures that improper usage of taskwait that risks deadlock should throw an exception. More...
 
void Boundary_parallelfor_should_except ()
 Ensures that overflows in the schedulers properly throw exceptions. More...
 

Private Member Functions

float[] saxpy_parallelregion_for (float a, float[] x, float[] y, Schedule schedule, uint? chunk_size)
 A sample workload for saxpy. More...
 
float[] saxpy_parallelregion_for_taskloop (float a, float[] x, float[] y, uint? grainsize)
 A sample workload for saxpy, using taskloops. More...
 
float[] saxpy_parallelfor (float a, float[] x, float[] y)
 Same as saxpy_parallelregion_for, but uses DotMP.Parallel.ParallelFor() instead of DotMP.Parallel.ParallelRegion() and DotMP.Parallel.For(). More...
 

Static Private Member Functions

static long Workload (bool inParallel)
 A sample workload for DotMP.Parallel.ParallelFor(). More...
 
static void InnerWorkload (int j, float[] a, float[] b, float[] c)
 A heavy workload for tests. More...
 
static uint CreateRegion ()
 Creates a parallel region and returns the number of threads spawned. More...
 

Private Attributes

readonly ITestOutputHelper output
 

Detailed Description

CPU tests for the DotMP library.

Constructor & Destructor Documentation

◆ CPUTests()

DotMPTests.CPUTests.CPUTests ( ITestOutputHelper  output)
inline

Constructor to write output.

Parameters
outputOutput object.

Member Function Documentation

◆ Absent_params_shouldnt_except()

void DotMPTests.CPUTests.Absent_params_shouldnt_except ( )
inline

Verifies that absent parameters shouldn't throw exceptions.

◆ Atomic_works()

void DotMPTests.CPUTests.Atomic_works ( )
inline

Tests to make sure that the DotMP.Atomic class works.

◆ Boundary_parallelfor_should_except()

void DotMPTests.CPUTests.Boundary_parallelfor_should_except ( )
inline

Ensures that overflows in the schedulers properly throw exceptions.

◆ Collapse_works()

void DotMPTests.CPUTests.Collapse_works ( )
inline

Tests to make sure that DotMP.Parallel.ForCollapse produces correct results.

◆ CreateRegion()

static uint DotMPTests.CPUTests.CreateRegion ( )
inlinestaticprivate

Creates a parallel region and returns the number of threads spawned.

Returns

◆ Critical_works()

void DotMPTests.CPUTests.Critical_works ( )
inline

Tests to make sure that DotMP.Parallel.Critical() works.

◆ Custom_scheduler_works()

void DotMPTests.CPUTests.Custom_scheduler_works ( )
inline

Verifies that custom schedulers work.

◆ Dynamic_should_produce_correct_results()

void DotMPTests.CPUTests.Dynamic_should_produce_correct_results ( )
inline

Tests to make sure that DotMP.Schedule.Dynamic produces correct results.

◆ Get_and_Set_NumThreads_work()

void DotMPTests.CPUTests.Get_and_Set_NumThreads_work ( )
inline

Tests to make sure that DotMP.Parallel.SetNumThreads() works.

◆ GetNested_works()

void DotMPTests.CPUTests.GetNested_works ( )
inline

Tests to make sure that DotMP.Parallel.GetNested() and DotMP.Parallel.SetNested() work.

◆ GetWTime_works()

void DotMPTests.CPUTests.GetWTime_works ( )
inline

Tests to make sure that DotMP.Parallel.GetWTime() works.

◆ Guided_should_produce_correct_results()

void DotMPTests.CPUTests.Guided_should_produce_correct_results ( )
inline

Tests to make sure that DotMP.Schedule.Guided produces correct results.

◆ Improper_taskwait_should_except()

void DotMPTests.CPUTests.Improper_taskwait_should_except ( )
inline

Ensures that improper usage of taskwait that risks deadlock should throw an exception.

◆ InnerWorkload()

static void DotMPTests.CPUTests.InnerWorkload ( int  j,
float[]  a,
float[]  b,
float[]  c 
)
inlinestaticprivate

A heavy workload for tests.

Parameters
jIndex to use into a, b, and c.
aFloat array 1 (destination).
bFloat array 2 (source).
cFloat array 3 (source).

◆ InParallel_works()

void DotMPTests.CPUTests.InParallel_works ( )
inline

Tests to make sure that DotMP.Parallel.InParallel() works.

◆ Invalid_params_should_except()

void DotMPTests.CPUTests.Invalid_params_should_except ( )
inline

Verifies that invalid parameters throw exceptions.

◆ Locks_work()

void DotMPTests.CPUTests.Locks_work ( )
inline

Tests to make sure that the DotMP.Locking and DotMP.Lock classes work.

◆ Master_works()

void DotMPTests.CPUTests.Master_works ( )
inline

Tests to make sure that DotMP.Parallel.Master() works.

◆ Nested_parallelism_should_except()

void DotMPTests.CPUTests.Nested_parallelism_should_except ( )
inline

Verifies that nested parallelism throws an exception.

◆ Nested_task_dependencies_work()

void DotMPTests.CPUTests.Nested_task_dependencies_work ( )
inline

Ensures that nested task dependencies work.

◆ Nested_tasks_work()

void DotMPTests.CPUTests.Nested_tasks_work ( )
inline

Checks to see if nested tasks work.

◆ Nested_taskwait_works()

void DotMPTests.CPUTests.Nested_taskwait_works ( )
inline

Checks that nested taskwait works.

◆ Nested_worksharing_should_except()

void DotMPTests.CPUTests.Nested_worksharing_should_except ( )
inline

Verifies that nested worksharing throws an exception.

◆ Non_for_ordered_should_except()

void DotMPTests.CPUTests.Non_for_ordered_should_except ( )
inline

Verifies that an ordered region used outside of a for region throws an exception.

◆ Non_parallel_barrier_should_except()

void DotMPTests.CPUTests.Non_parallel_barrier_should_except ( )
inline

Verifies that a barrier used outside of a parallel region throws an exception.

◆ Non_parallel_critical_should_except()

void DotMPTests.CPUTests.Non_parallel_critical_should_except ( )
inline

Verifies that a critical region used outside of a parallel region throws an exception.

◆ Non_parallel_for_should_except()

void DotMPTests.CPUTests.Non_parallel_for_should_except ( )
inline

Verifies that a Parallel.For used outside of a parallel region throws an exception.

◆ Non_parallel_GetThreadNum_should_except()

void DotMPTests.CPUTests.Non_parallel_GetThreadNum_should_except ( )
inline

Verifies that GetThreadNum used outside of a parallel region throws an exception.

◆ Non_parallel_master_should_except()

void DotMPTests.CPUTests.Non_parallel_master_should_except ( )
inline

Verifies that a master region used outside of a parallel region throws an exception.

◆ Non_parallel_sections_should_except()

void DotMPTests.CPUTests.Non_parallel_sections_should_except ( )
inline

Verifies that a sections region used outside of a parallel region throws an exception.

◆ Non_parallel_single_should_except()

void DotMPTests.CPUTests.Non_parallel_single_should_except ( )
inline

Verifies that a single region used outside of a parallel region throws an exception.

◆ Ordered_works()

void DotMPTests.CPUTests.Ordered_works ( )
inline

Tests to make sure that DotMP.Parallel.Ordered() works.

◆ Overflow_for_should_except()

void DotMPTests.CPUTests.Overflow_for_should_except ( )
inline

Verifies that for loops which overflow internal indices should throw an exception.

◆ Parallel_performance_should_be_higher()

void DotMPTests.CPUTests.Parallel_performance_should_be_higher ( )
inline

Tests to make sure that parallel performance is higher than sequential performance.

◆ Parallel_should_work()

void DotMPTests.CPUTests.Parallel_should_work ( )
inline

Tests to make sure that DotMP.Parallel.ParallelRegion()'s are actually created.

◆ Parallelfor_should_work()

void DotMPTests.CPUTests.Parallelfor_should_work ( )
inline

Tests the functionality of DotMP.Parallel.For().

◆ Reduction_collapse_works()

void DotMPTests.CPUTests.Reduction_collapse_works ( )
inline

Tests to make sure that DotMP.Parallel.ForReductionCollapse produces correct results.

◆ Reduction_works()

void DotMPTests.CPUTests.Reduction_works ( )
inline

Tests to make sure that DotMP.Parallel.ForReduction<T>() works.

◆ saxpy_parallelfor()

float [] DotMPTests.CPUTests.saxpy_parallelfor ( float  a,
float[]  x,
float[]  y 
)
inlineprivate

Same as saxpy_parallelregion_for, but uses DotMP.Parallel.ParallelFor() instead of DotMP.Parallel.ParallelRegion() and DotMP.Parallel.For().

Parameters
aScalar for saxpy.
xVector to multiply by the scalar.
yVector to add.
Returns
Result of saxpy.

◆ saxpy_parallelregion_for()

float [] DotMPTests.CPUTests.saxpy_parallelregion_for ( float  a,
float[]  x,
float[]  y,
Schedule  schedule,
uint?  chunk_size 
)
inlineprivate

A sample workload for saxpy.

Parameters
aScalar for saxpy.
xVector to multiply by the scalar.
yVector to add.
scheduleSchedule to use.
chunk_sizeChunk size to use.
Returns
Result of saxpy.

◆ saxpy_parallelregion_for_taskloop()

float [] DotMPTests.CPUTests.saxpy_parallelregion_for_taskloop ( float  a,
float[]  x,
float[]  y,
uint?  grainsize 
)
inlineprivate

A sample workload for saxpy, using taskloops.

Parameters
aScalar for saxpy.
xVector to multiply by the scalar.
yVector to add.
grainsizeGrainsize to use
Returns
Result of saxpy.

◆ Schedule_runtime_works()

void DotMPTests.CPUTests.Schedule_runtime_works ( )
inline

Tests to make sure that DotMP.Parallel.Schedule.Runtime properly reads values from the environment variable.

◆ Sections_works()

void DotMPTests.CPUTests.Sections_works ( )
inline

Tests to make sure that DotMP.Parallel.Sections() and DotMP.Parallel.Section() work.

◆ SetDynamic_works()

void DotMPTests.CPUTests.SetDynamic_works ( )
inline

Tests to make sure that DotMP.Parallel.SetDynamic() works.

◆ Shared_works()

void DotMPTests.CPUTests.Shared_works ( )
inline

Tests to make sure the DotMP.Shared class works.

◆ SharedEnumerable_works()

void DotMPTests.CPUTests.SharedEnumerable_works ( )
inline

Tests to make sure the DotMP.SharedEnumerable class works.

◆ Single_works()

void DotMPTests.CPUTests.Single_works ( )
inline

Tests to make sure that DotMP.Parallel.Single() works.

◆ Static_should_produce_correct_results()

void DotMPTests.CPUTests.Static_should_produce_correct_results ( )
inline

Tests to make sure that DotMP.Schedule.Static produces correct results.

◆ Task_dependencies_work()

void DotMPTests.CPUTests.Task_dependencies_work ( )
inline

Test if taskloop dependencies work.

◆ Tasking_works()

void DotMPTests.CPUTests.Tasking_works ( )
inline

Tests to see if the basics of tasking work.

◆ Taskloop_dependencies_work()

void DotMPTests.CPUTests.Taskloop_dependencies_work ( )
inline

Tests taskloop dependencies, and in turn, more complex dependency chaining.

◆ Taskloop_only_if_works()

void DotMPTests.CPUTests.Taskloop_only_if_works ( )
inline

Test if the only_if clause works on taskloops.

◆ Taskloop_should_produce_correct_results()

void DotMPTests.CPUTests.Taskloop_should_produce_correct_results ( )
inline

Tests to make sure that taskloops produce correct results.

◆ Workload()

static long DotMPTests.CPUTests.Workload ( bool  inParallel)
inlinestaticprivate

A sample workload for DotMP.Parallel.ParallelFor().

Parameters
inParallelWhether or not to enable parallelism.
Returns
Elapsed milliseconds of the test.

◆ Workstealing_load_balances()

void DotMPTests.CPUTests.Workstealing_load_balances ( )
inline

Tests to ensure that workstealing adequately load balances.

◆ Workstealing_should_produce_correct_results()

void DotMPTests.CPUTests.Workstealing_should_produce_correct_results ( )
inline

Tests to make sure that DotMP.Schedule.Guided produces correct results.

Member Data Documentation

◆ output

readonly ITestOutputHelper DotMPTests.CPUTests.output
private

The documentation for this class was generated from the following file: