SlideShare a Scribd company logo
1 of 5
Download to read offline
Testing parallel programs
Author: Andrey Karpov

Date: 02.11.2008


Abstract
Testing parallel software is a more complicated task in comparison to testing a standard program. The
programmer should be aware both of the traps he can face while testing parallel code and existing
methodologies and toolkit.


Introduction
Speaking about software development we single out the step of testing and debugging an application.
The notions of testing and debugging are understood as nearly the same. It is due to that after an error
is found during the process of testing its correction often relates to the process of debugging of a
program. And debugging of an application can be in its turn called "white-box" method testing.
Sometimes the step of debugging is understood as simultaneous search and correction of errors.

Still, we'll distinguish between these two notions and concentrate on testing parallel software in this
article.

Testing software is a process of detecting errors in software by using different tools and analysis of
program workability by end users [1].

Debugging is a process of finding errors by the programmer in the code which were detected while
testing the software to correct them. Debugging usually implies using specialized tools for tracking the
program's state while executing it.

Debugging parallel programs is a thankless task demanding accuracy and use of specialized tools. A lot
of articles are devoted to debugging parallel programs and even more should be devoted as this topic is
very urgent because of rapid development of multicore systems and new technologies of creating
parallel programs. In the sphere of toolkits there are also some problems. But before you could perform
debugging you should find the error. Meanwhile some debugging methods not only find errors but also
detect their locations. That's why let's consider testing.


1. Parallel program testing difficulties
Testing applications with parallel processing is not a simple task. Paralleling errors are difficult to detect
because of parallel applications' non-determined behavior. Even if an error is detected it is often difficult
to reproduce it. Besides, when the code is modified it is not so easy to make sure that the error is really
corrected and not concealed. We can give it another name, that is the errors in a parallel program are
typical "heisenbugs".

Heisenbug is a term used in programming to define a program error which disappears or changes its
properties when trying to detect it [2]. This name is a pun and comes from a physics term "Heisenberg
uncertainty principle" which is understood in everyday life as a change of an object being observed
occurring in quantum mechanics. An example of such errors is errors which show up in the final program
version ("release") but cannot be seen in debugging mode; synchronization errors in a multithread
application are another example.

Thus, the task of parallel testing on a whole comes to the problem of creating diagnosing tools which
minimally influence a program's behavior or creating all the necessary conditions for it to occur. That's
why let's look at the classic methodologies from a new viewpoint.


2. Methods of searching errors in parallel programs
Methods of searching errors in parallel applications as well as in sequential ones can be divided into
dynamic analysis, static analysis, model-based test and program's correctness proof [3].

Formal proof of a program's correctness is a very complicated procedure especially in the sphere of
parallel programming and it is usually not used in industrial software development.

Dynamic analysis implies the necessity of launching an application and executing different sequences of
operations which aim at detecting incorrect program behavior. A sequence of operations can be defined
both by man during manual testing and when using different tools implementing load testing or, for
example, check of data integrity. In case of parallel programs of the most interest are tools like Intel
Thread Checker which provide an application's source code with monitoring and logging means which
allow you to detect deadlocks (both explicit and potential), hangs, races etc [4].

Static analysis handles only an application's program code without launching it. As an advantage of this
method we can single out detailed and full coverage of the analyzed code. We should mention that in
the sphere of parallel programming static analysis method is used rather rarely and is represented by
few tools which are rather research tools than commercial products.

Model-based test is automatic generation of tests according to the defined rules. Model-based test
allows you to formally ground absence of defects in the code part being tested on the basis of the rules
of data conversion defined by the developer. Such an example is KISS tool developed in Microsoft
Research for C parallel programs.

All the mentioned methods have disadvantages and this doesn't allow you to rely only on one of them
when developing parallel programs.

Dynamic analysis demands launching programs, it is sensitive to the execution environment and it
significantly slows down the speed of application execution. It is rather difficult to cover the whole
parallel code with tests. It is often possible to detect race conditions only when it occurred in the given
program session. That is, if a dynamic analysis means informs you that there are no errors yet you
cannot be sure about it.

In case of parallel applications static analysis is very complicated and it is often impossible to predict the
program's behavior as the acceptable set of input values for different functions and the way of calling
them are unknown. These values can be predicted on the basis of the rest code but within certain limits
as a huge space of possible states appears and the size of the tested information (variants) becomes
unacceptably large. Besides, static analysis means often display a lot of false messages about potential
errors and demand great effort to minimize their number.
In practice model-based test works only for small base blocks of an application. In most cases it is very
difficult to automatically build a model on the basis of the code while manual creation of models is a
very laborious and resource-intensive operation. In fact, it is necessary to write the same data
conversion algorithms but in a different presentation. As in case of static analysis a problem of quick
extension of state space appears. State space extension can be partially controlled by using methods of
reduction with complex heuristic logic but it leads to that some defects will be missed. An example of a
tool for testing parallel application projects on the basis of models is Zing.

As we see, using only one of the approaches to testing parallel applications is inefficient and it would be
a good solution to use several methods for testing one and the same program product.


3. New technologies - new tools
As the choice was made for benefit of multicore processors when solving the task of performance
increase this resulted in a new round of development toolkit advance. For multicore systems with
common memory it is more convenient to use such programming technologies as OpenMP instead of
more habitual MPI or standard paralleling means provided by operational systems (fork, beginthread).

New technologies need new tools for supporting them. Now we should attentively follow the new
systems of parallel programming support appearing on software market. They can significantly simplify
your work and help you to quicker adapt your applications for efficient use of the parallel environment.
One of such tools is the static code analyzer VivaMP developed by OOO "Program Verification Systems"
company.

As was said before static analysis of parallel programs is complicated and ineffective as it is necessary to
store too much information about the possible program states. This is absolutely true in case of using
such parallel programming technologies as MPI or paralleling by operational systems means.

It is better in case of OpenMP technology and you can often implement efficient static analysis
possessing good characteristics. This is due to that OpenMP technology is meant for paralleling isolated
code sections. OpenMP, so to say, allows you to make a program parallel "in small parts" by putting
special directions in the most performance-critical code sections. As the result the parallel code appears
to be grouped and it doesn't depend on other application's parts what allows you to perform a high-
quality analysis.

Until recently the area of static analysis of OpenMP programs has not practically been developed. We
can give only one example, that is Sun Studio compiler performing rather good diagnosis. VivaMP static
analyzer has occupied this sphere. This is a specialized tool for searching errors in parallel programs
developed with the use of OpenMP technology in C and C++ languages [5].

This analyzer both detects explicit errors and informs about potentially unsafe code. To show the
process of error diagnosis let's consider an example of detecting use of one variable for saving from
parallel streams without necessary synchronization::

int sum1 = 0;

int sum2 = 0;

#pragma omp parallel for

   for (size_t i = 0; i != n; ++i)
{

        sum1 += array[i]; // V1205

        #pragma atomic

        sum2 += array[i]; //Fine

    }

And to show the process of potentially unsafe code diagnosis let's consider an example of using flush for
a pointer. It's easy to make a mistake and forget that it is the pointer to which flush operation will be
applied and not the data it refers to. As the result the given code can be both correct and incorrect:

int *ptr;

...

#pragma omp flush(ptr) // V1202

int value = *ptr;

In the next VivaMP analyzer's version some tests will be implemented which relate to detecting
ineffective parallel code. For example, there will appear critical sections where it would be only enough
to use the quicker directive atomic:

#pragma omp critical

{

    a++;    //Slow

}

#pragma omp atomic

a++; //Good


Conclusion
Different forms of paralleling have existed in the software world for a long time. But to create mass
commercial applications which would use the possibilities of multicore processors to full extend we
need other development means different from those used when creating sequential applications. We
hope that this article will throw light on all those difficulties relating to development of parallel
applications and the programmer will be most serious when choosing appropriate means of developing
and testing such programs.


References
    1. Wikipedia. Testing software. http://www.viva64.com/go.php?url=152
    2. Wikipedia. Heisenbug. http://www.viva64.com/go.php?url=153
    3. Rahul V. Patil and Boby George. Tools And Techniques to Identify Concurrency Issues.
       http://www.viva64.com/go.php?url=154
4. Evgeniy Romanovski. Debugging of multi-thread OpenMP-programs.
   http://www.viva64.com/go.php?url=155
5. Andrey Karpov, Evgeniy Ryzhkov. Adaptation of the technology of the static code analyzer for
   developing parallel programs.. http://www.viva64.com/art-3-2-486346462.html

More Related Content

What's hot

PVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio
 
Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test Gregory Solovey
 
How we test the code analyzer
How we test the code analyzerHow we test the code analyzer
How we test the code analyzerPVS-Studio
 
Regular use of static code analysis in team development
Regular use of static code analysis in team developmentRegular use of static code analysis in team development
Regular use of static code analysis in team developmentPVS-Studio
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging TechniquesBala Subra
 
Regular use of static code analysis in team development
Regular use of static code analysis in team developmentRegular use of static code analysis in team development
Regular use of static code analysis in team developmentPVS-Studio
 
Regular use of static code analysis in team development
Regular use of static code analysis in team developmentRegular use of static code analysis in team development
Regular use of static code analysis in team developmentAndrey Karpov
 
Detection of vulnerabilities in programs with the help of code analyzers
Detection of vulnerabilities in programs with the help of code analyzersDetection of vulnerabilities in programs with the help of code analyzers
Detection of vulnerabilities in programs with the help of code analyzersPVS-Studio
 
Software testing for biginners
Software testing for biginnersSoftware testing for biginners
Software testing for biginnersSriman Eshwar
 
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.Wolfgang Grieskamp
 
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in IndustryAssessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in IndustryDharmalingam Ganesan
 
Testing project (basic)
Testing project (basic)Testing project (basic)
Testing project (basic)Lokesh Singrol
 
Unit 3 Control Flow Testing
Unit 3   Control Flow TestingUnit 3   Control Flow Testing
Unit 3 Control Flow Testingravikhimani
 
Comparing PVS-Studio with other code analyzers
Comparing PVS-Studio with other code analyzersComparing PVS-Studio with other code analyzers
Comparing PVS-Studio with other code analyzersPVS-Studio
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow TestingHirra Sultan
 
Software testing introduction
Software testing introductionSoftware testing introduction
Software testing introductionSriman Eshwar
 
Hands-on Experience Model based testing with spec explorer
Hands-on Experience Model based testing with spec explorer Hands-on Experience Model based testing with spec explorer
Hands-on Experience Model based testing with spec explorer Rachid Kherrazi
 

What's hot (20)

PVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ code
 
Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test
 
How we test the code analyzer
How we test the code analyzerHow we test the code analyzer
How we test the code analyzer
 
Regular use of static code analysis in team development
Regular use of static code analysis in team developmentRegular use of static code analysis in team development
Regular use of static code analysis in team development
 
Debug me
Debug meDebug me
Debug me
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
 
Regular use of static code analysis in team development
Regular use of static code analysis in team developmentRegular use of static code analysis in team development
Regular use of static code analysis in team development
 
Regular use of static code analysis in team development
Regular use of static code analysis in team developmentRegular use of static code analysis in team development
Regular use of static code analysis in team development
 
Detection of vulnerabilities in programs with the help of code analyzers
Detection of vulnerabilities in programs with the help of code analyzersDetection of vulnerabilities in programs with the help of code analyzers
Detection of vulnerabilities in programs with the help of code analyzers
 
Software testing for biginners
Software testing for biginnersSoftware testing for biginners
Software testing for biginners
 
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
 
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in IndustryAssessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
 
Testing project (basic)
Testing project (basic)Testing project (basic)
Testing project (basic)
 
Unit 3 Control Flow Testing
Unit 3   Control Flow TestingUnit 3   Control Flow Testing
Unit 3 Control Flow Testing
 
Comparing PVS-Studio with other code analyzers
Comparing PVS-Studio with other code analyzersComparing PVS-Studio with other code analyzers
Comparing PVS-Studio with other code analyzers
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow Testing
 
Interactive debugging system
Interactive debugging systemInteractive debugging system
Interactive debugging system
 
Rv11
Rv11Rv11
Rv11
 
Software testing introduction
Software testing introductionSoftware testing introduction
Software testing introduction
 
Hands-on Experience Model based testing with spec explorer
Hands-on Experience Model based testing with spec explorer Hands-on Experience Model based testing with spec explorer
Hands-on Experience Model based testing with spec explorer
 

Viewers also liked

Introduction into the problems of developing parallel programs
Introduction into the problems of developing parallel programsIntroduction into the problems of developing parallel programs
Introduction into the problems of developing parallel programsPVS-Studio
 
Lesson 16. Pattern 8. Memsize-types in unions
Lesson 16. Pattern 8. Memsize-types in unionsLesson 16. Pattern 8. Memsize-types in unions
Lesson 16. Pattern 8. Memsize-types in unionsPVS-Studio
 
Optimization in the world of 64-bit errors
Optimization  in the world of 64-bit errorsOptimization  in the world of 64-bit errors
Optimization in the world of 64-bit errorsPVS-Studio
 
Analysis of the Ultimate Toolbox project
Analysis of the Ultimate Toolbox projectAnalysis of the Ultimate Toolbox project
Analysis of the Ultimate Toolbox projectPVS-Studio
 
Lesson 19. Pattern 11. Serialization and data interchange
Lesson 19. Pattern 11. Serialization and data interchangeLesson 19. Pattern 11. Serialization and data interchange
Lesson 19. Pattern 11. Serialization and data interchangePVS-Studio
 
Lesson 21. Pattern 13. Data alignment
Lesson 21. Pattern 13. Data alignmentLesson 21. Pattern 13. Data alignment
Lesson 21. Pattern 13. Data alignmentPVS-Studio
 
Parallel programs to multi-processor computers!
Parallel programs to multi-processor computers!Parallel programs to multi-processor computers!
Parallel programs to multi-processor computers!PVS-Studio
 
VivaMP - a tool for OpenMP
VivaMP - a tool for OpenMPVivaMP - a tool for OpenMP
VivaMP - a tool for OpenMPPVS-Studio
 
The use of the code analysis library OpenC++: modifications, improvements, er...
The use of the code analysis library OpenC++: modifications, improvements, er...The use of the code analysis library OpenC++: modifications, improvements, er...
The use of the code analysis library OpenC++: modifications, improvements, er...PVS-Studio
 

Viewers also liked (9)

Introduction into the problems of developing parallel programs
Introduction into the problems of developing parallel programsIntroduction into the problems of developing parallel programs
Introduction into the problems of developing parallel programs
 
Lesson 16. Pattern 8. Memsize-types in unions
Lesson 16. Pattern 8. Memsize-types in unionsLesson 16. Pattern 8. Memsize-types in unions
Lesson 16. Pattern 8. Memsize-types in unions
 
Optimization in the world of 64-bit errors
Optimization  in the world of 64-bit errorsOptimization  in the world of 64-bit errors
Optimization in the world of 64-bit errors
 
Analysis of the Ultimate Toolbox project
Analysis of the Ultimate Toolbox projectAnalysis of the Ultimate Toolbox project
Analysis of the Ultimate Toolbox project
 
Lesson 19. Pattern 11. Serialization and data interchange
Lesson 19. Pattern 11. Serialization and data interchangeLesson 19. Pattern 11. Serialization and data interchange
Lesson 19. Pattern 11. Serialization and data interchange
 
Lesson 21. Pattern 13. Data alignment
Lesson 21. Pattern 13. Data alignmentLesson 21. Pattern 13. Data alignment
Lesson 21. Pattern 13. Data alignment
 
Parallel programs to multi-processor computers!
Parallel programs to multi-processor computers!Parallel programs to multi-processor computers!
Parallel programs to multi-processor computers!
 
VivaMP - a tool for OpenMP
VivaMP - a tool for OpenMPVivaMP - a tool for OpenMP
VivaMP - a tool for OpenMP
 
The use of the code analysis library OpenC++: modifications, improvements, er...
The use of the code analysis library OpenC++: modifications, improvements, er...The use of the code analysis library OpenC++: modifications, improvements, er...
The use of the code analysis library OpenC++: modifications, improvements, er...
 

Similar to Testing parallel programs

SOFTWARE TESTING.pptx
SOFTWARE TESTING.pptxSOFTWARE TESTING.pptx
SOFTWARE TESTING.pptxssrpr
 
Traps detection during migration of C and C++ code to 64-bit Windows
Traps detection during migration of C and C++ code to 64-bit WindowsTraps detection during migration of C and C++ code to 64-bit Windows
Traps detection during migration of C and C++ code to 64-bit WindowsPVS-Studio
 
Unit Testing Essay
Unit Testing EssayUnit Testing Essay
Unit Testing EssayDani Cox
 
Embedded software static analysis_Polyspace-WhitePaper_final
Embedded software static analysis_Polyspace-WhitePaper_finalEmbedded software static analysis_Polyspace-WhitePaper_final
Embedded software static analysis_Polyspace-WhitePaper_finalTAMILMARAN C
 
Problems of testing 64-bit applications
Problems of testing 64-bit applicationsProblems of testing 64-bit applications
Problems of testing 64-bit applicationsPVS-Studio
 
Adaptation of the technology of the static code analyzer for developing paral...
Adaptation of the technology of the static code analyzer for developing paral...Adaptation of the technology of the static code analyzer for developing paral...
Adaptation of the technology of the static code analyzer for developing paral...PVS-Studio
 
st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...
st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...
st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...mwpeexdvjgtqujwhog
 
Machine Learning in Static Analysis of Program Source Code
Machine Learning in Static Analysis of Program Source CodeMachine Learning in Static Analysis of Program Source Code
Machine Learning in Static Analysis of Program Source CodeAndrey Karpov
 
Defect effort prediction models in software
Defect effort prediction models in softwareDefect effort prediction models in software
Defect effort prediction models in softwareIAEME Publication
 
An ideal static analyzer, or why ideals are unachievable
An ideal static analyzer, or why ideals are unachievableAn ideal static analyzer, or why ideals are unachievable
An ideal static analyzer, or why ideals are unachievablePVS-Studio
 
0136 ideal static_analyzer
0136 ideal static_analyzer0136 ideal static_analyzer
0136 ideal static_analyzerPVS-Studio
 
Chapter 9 Testing Strategies.ppt
Chapter 9 Testing Strategies.pptChapter 9 Testing Strategies.ppt
Chapter 9 Testing Strategies.pptVijayaPratapReddyM
 
Static analysis is most efficient when being used regularly. We'll tell you w...
Static analysis is most efficient when being used regularly. We'll tell you w...Static analysis is most efficient when being used regularly. We'll tell you w...
Static analysis is most efficient when being used regularly. We'll tell you w...PVS-Studio
 
Feb 2013Lesson 38 Software Acquisition Development
Feb 2013Lesson 38 Software Acquisition DevelopmentFeb 2013Lesson 38 Software Acquisition Development
Feb 2013Lesson 38 Software Acquisition DevelopmentBarb Tillich
 
Manual Testing guide by nagula sai kiran.docx
Manual Testing guide by nagula sai kiran.docxManual Testing guide by nagula sai kiran.docx
Manual Testing guide by nagula sai kiran.docxsai kiran
 
S D D Program Development Tools
S D D  Program  Development  ToolsS D D  Program  Development  Tools
S D D Program Development Toolsgavhays
 
Top 5 Code Coverage Tools in DevOps
Top 5 Code Coverage Tools in DevOpsTop 5 Code Coverage Tools in DevOps
Top 5 Code Coverage Tools in DevOpsscmGalaxy Inc
 
PVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codeAndrey Karpov
 

Similar to Testing parallel programs (20)

SOFTWARE TESTING.pptx
SOFTWARE TESTING.pptxSOFTWARE TESTING.pptx
SOFTWARE TESTING.pptx
 
Traps detection during migration of C and C++ code to 64-bit Windows
Traps detection during migration of C and C++ code to 64-bit WindowsTraps detection during migration of C and C++ code to 64-bit Windows
Traps detection during migration of C and C++ code to 64-bit Windows
 
Unit Testing Essay
Unit Testing EssayUnit Testing Essay
Unit Testing Essay
 
Embedded software static analysis_Polyspace-WhitePaper_final
Embedded software static analysis_Polyspace-WhitePaper_finalEmbedded software static analysis_Polyspace-WhitePaper_final
Embedded software static analysis_Polyspace-WhitePaper_final
 
Problems of testing 64-bit applications
Problems of testing 64-bit applicationsProblems of testing 64-bit applications
Problems of testing 64-bit applications
 
Adaptation of the technology of the static code analyzer for developing paral...
Adaptation of the technology of the static code analyzer for developing paral...Adaptation of the technology of the static code analyzer for developing paral...
Adaptation of the technology of the static code analyzer for developing paral...
 
st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...
st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...
st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...
 
Machine Learning in Static Analysis of Program Source Code
Machine Learning in Static Analysis of Program Source CodeMachine Learning in Static Analysis of Program Source Code
Machine Learning in Static Analysis of Program Source Code
 
Defect effort prediction models in software
Defect effort prediction models in softwareDefect effort prediction models in software
Defect effort prediction models in software
 
An ideal static analyzer, or why ideals are unachievable
An ideal static analyzer, or why ideals are unachievableAn ideal static analyzer, or why ideals are unachievable
An ideal static analyzer, or why ideals are unachievable
 
0136 ideal static_analyzer
0136 ideal static_analyzer0136 ideal static_analyzer
0136 ideal static_analyzer
 
Chapter 9 Testing Strategies.ppt
Chapter 9 Testing Strategies.pptChapter 9 Testing Strategies.ppt
Chapter 9 Testing Strategies.ppt
 
Static analysis is most efficient when being used regularly. We'll tell you w...
Static analysis is most efficient when being used regularly. We'll tell you w...Static analysis is most efficient when being used regularly. We'll tell you w...
Static analysis is most efficient when being used regularly. We'll tell you w...
 
Feb 2013Lesson 38 Software Acquisition Development
Feb 2013Lesson 38 Software Acquisition DevelopmentFeb 2013Lesson 38 Software Acquisition Development
Feb 2013Lesson 38 Software Acquisition Development
 
Manual Testing guide by nagula sai kiran.docx
Manual Testing guide by nagula sai kiran.docxManual Testing guide by nagula sai kiran.docx
Manual Testing guide by nagula sai kiran.docx
 
SE-Testing.ppt
SE-Testing.pptSE-Testing.ppt
SE-Testing.ppt
 
S D D Program Development Tools
S D D  Program  Development  ToolsS D D  Program  Development  Tools
S D D Program Development Tools
 
Software Testing
 Software Testing  Software Testing
Software Testing
 
Top 5 Code Coverage Tools in DevOps
Top 5 Code Coverage Tools in DevOpsTop 5 Code Coverage Tools in DevOps
Top 5 Code Coverage Tools in DevOps
 
PVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ code
 

Recently uploaded

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 

Testing parallel programs

  • 1. Testing parallel programs Author: Andrey Karpov Date: 02.11.2008 Abstract Testing parallel software is a more complicated task in comparison to testing a standard program. The programmer should be aware both of the traps he can face while testing parallel code and existing methodologies and toolkit. Introduction Speaking about software development we single out the step of testing and debugging an application. The notions of testing and debugging are understood as nearly the same. It is due to that after an error is found during the process of testing its correction often relates to the process of debugging of a program. And debugging of an application can be in its turn called "white-box" method testing. Sometimes the step of debugging is understood as simultaneous search and correction of errors. Still, we'll distinguish between these two notions and concentrate on testing parallel software in this article. Testing software is a process of detecting errors in software by using different tools and analysis of program workability by end users [1]. Debugging is a process of finding errors by the programmer in the code which were detected while testing the software to correct them. Debugging usually implies using specialized tools for tracking the program's state while executing it. Debugging parallel programs is a thankless task demanding accuracy and use of specialized tools. A lot of articles are devoted to debugging parallel programs and even more should be devoted as this topic is very urgent because of rapid development of multicore systems and new technologies of creating parallel programs. In the sphere of toolkits there are also some problems. But before you could perform debugging you should find the error. Meanwhile some debugging methods not only find errors but also detect their locations. That's why let's consider testing. 1. Parallel program testing difficulties Testing applications with parallel processing is not a simple task. Paralleling errors are difficult to detect because of parallel applications' non-determined behavior. Even if an error is detected it is often difficult to reproduce it. Besides, when the code is modified it is not so easy to make sure that the error is really corrected and not concealed. We can give it another name, that is the errors in a parallel program are typical "heisenbugs". Heisenbug is a term used in programming to define a program error which disappears or changes its properties when trying to detect it [2]. This name is a pun and comes from a physics term "Heisenberg uncertainty principle" which is understood in everyday life as a change of an object being observed
  • 2. occurring in quantum mechanics. An example of such errors is errors which show up in the final program version ("release") but cannot be seen in debugging mode; synchronization errors in a multithread application are another example. Thus, the task of parallel testing on a whole comes to the problem of creating diagnosing tools which minimally influence a program's behavior or creating all the necessary conditions for it to occur. That's why let's look at the classic methodologies from a new viewpoint. 2. Methods of searching errors in parallel programs Methods of searching errors in parallel applications as well as in sequential ones can be divided into dynamic analysis, static analysis, model-based test and program's correctness proof [3]. Formal proof of a program's correctness is a very complicated procedure especially in the sphere of parallel programming and it is usually not used in industrial software development. Dynamic analysis implies the necessity of launching an application and executing different sequences of operations which aim at detecting incorrect program behavior. A sequence of operations can be defined both by man during manual testing and when using different tools implementing load testing or, for example, check of data integrity. In case of parallel programs of the most interest are tools like Intel Thread Checker which provide an application's source code with monitoring and logging means which allow you to detect deadlocks (both explicit and potential), hangs, races etc [4]. Static analysis handles only an application's program code without launching it. As an advantage of this method we can single out detailed and full coverage of the analyzed code. We should mention that in the sphere of parallel programming static analysis method is used rather rarely and is represented by few tools which are rather research tools than commercial products. Model-based test is automatic generation of tests according to the defined rules. Model-based test allows you to formally ground absence of defects in the code part being tested on the basis of the rules of data conversion defined by the developer. Such an example is KISS tool developed in Microsoft Research for C parallel programs. All the mentioned methods have disadvantages and this doesn't allow you to rely only on one of them when developing parallel programs. Dynamic analysis demands launching programs, it is sensitive to the execution environment and it significantly slows down the speed of application execution. It is rather difficult to cover the whole parallel code with tests. It is often possible to detect race conditions only when it occurred in the given program session. That is, if a dynamic analysis means informs you that there are no errors yet you cannot be sure about it. In case of parallel applications static analysis is very complicated and it is often impossible to predict the program's behavior as the acceptable set of input values for different functions and the way of calling them are unknown. These values can be predicted on the basis of the rest code but within certain limits as a huge space of possible states appears and the size of the tested information (variants) becomes unacceptably large. Besides, static analysis means often display a lot of false messages about potential errors and demand great effort to minimize their number.
  • 3. In practice model-based test works only for small base blocks of an application. In most cases it is very difficult to automatically build a model on the basis of the code while manual creation of models is a very laborious and resource-intensive operation. In fact, it is necessary to write the same data conversion algorithms but in a different presentation. As in case of static analysis a problem of quick extension of state space appears. State space extension can be partially controlled by using methods of reduction with complex heuristic logic but it leads to that some defects will be missed. An example of a tool for testing parallel application projects on the basis of models is Zing. As we see, using only one of the approaches to testing parallel applications is inefficient and it would be a good solution to use several methods for testing one and the same program product. 3. New technologies - new tools As the choice was made for benefit of multicore processors when solving the task of performance increase this resulted in a new round of development toolkit advance. For multicore systems with common memory it is more convenient to use such programming technologies as OpenMP instead of more habitual MPI or standard paralleling means provided by operational systems (fork, beginthread). New technologies need new tools for supporting them. Now we should attentively follow the new systems of parallel programming support appearing on software market. They can significantly simplify your work and help you to quicker adapt your applications for efficient use of the parallel environment. One of such tools is the static code analyzer VivaMP developed by OOO "Program Verification Systems" company. As was said before static analysis of parallel programs is complicated and ineffective as it is necessary to store too much information about the possible program states. This is absolutely true in case of using such parallel programming technologies as MPI or paralleling by operational systems means. It is better in case of OpenMP technology and you can often implement efficient static analysis possessing good characteristics. This is due to that OpenMP technology is meant for paralleling isolated code sections. OpenMP, so to say, allows you to make a program parallel "in small parts" by putting special directions in the most performance-critical code sections. As the result the parallel code appears to be grouped and it doesn't depend on other application's parts what allows you to perform a high- quality analysis. Until recently the area of static analysis of OpenMP programs has not practically been developed. We can give only one example, that is Sun Studio compiler performing rather good diagnosis. VivaMP static analyzer has occupied this sphere. This is a specialized tool for searching errors in parallel programs developed with the use of OpenMP technology in C and C++ languages [5]. This analyzer both detects explicit errors and informs about potentially unsafe code. To show the process of error diagnosis let's consider an example of detecting use of one variable for saving from parallel streams without necessary synchronization:: int sum1 = 0; int sum2 = 0; #pragma omp parallel for for (size_t i = 0; i != n; ++i)
  • 4. { sum1 += array[i]; // V1205 #pragma atomic sum2 += array[i]; //Fine } And to show the process of potentially unsafe code diagnosis let's consider an example of using flush for a pointer. It's easy to make a mistake and forget that it is the pointer to which flush operation will be applied and not the data it refers to. As the result the given code can be both correct and incorrect: int *ptr; ... #pragma omp flush(ptr) // V1202 int value = *ptr; In the next VivaMP analyzer's version some tests will be implemented which relate to detecting ineffective parallel code. For example, there will appear critical sections where it would be only enough to use the quicker directive atomic: #pragma omp critical { a++; //Slow } #pragma omp atomic a++; //Good Conclusion Different forms of paralleling have existed in the software world for a long time. But to create mass commercial applications which would use the possibilities of multicore processors to full extend we need other development means different from those used when creating sequential applications. We hope that this article will throw light on all those difficulties relating to development of parallel applications and the programmer will be most serious when choosing appropriate means of developing and testing such programs. References 1. Wikipedia. Testing software. http://www.viva64.com/go.php?url=152 2. Wikipedia. Heisenbug. http://www.viva64.com/go.php?url=153 3. Rahul V. Patil and Boby George. Tools And Techniques to Identify Concurrency Issues. http://www.viva64.com/go.php?url=154
  • 5. 4. Evgeniy Romanovski. Debugging of multi-thread OpenMP-programs. http://www.viva64.com/go.php?url=155 5. Andrey Karpov, Evgeniy Ryzhkov. Adaptation of the technology of the static code analyzer for developing parallel programs.. http://www.viva64.com/art-3-2-486346462.html