OpenMP Debugging in Visual Studio / Team Debug

From CDOT Wiki
Revision as of 09:42, 4 December 2017 by Ashimazaki (talk | contribs) (Processes window)
Jump to: navigation, search

Group Members

  1. Sofia Ngo-Trong
  2. Azusa Shimazaki
  3. Orlandson Asturiano

please feel free to change the contents' depth!!!

test1

test

Processes(Rough)

Processes Why would you have multiple projects in one solution? https://stackoverflow.com/questions/8678251/benefits-of-multiple-projects-and-one-solution

  • services
  • custom setup actions
  • working multiple languages
  • creating libraries used in different places
  • large programs could be made up of many smaller projects for better management
  • working with multiple applications that interact with each other

Configuration

https://msdn.microsoft.com/en-us/library/jj919165.aspx

By default breaking/stepping/stopping applies to all other processes, but can be changed if you needed.

In order to add a new process you need to find the .pdb files.

The debugger needs access to these files of the processes

.pdb file holds the debugging and project state info that’s created on compile


Multiple processes

Each project is an individual process

If you have more than one project in a project solution, you can choose which projects the debugger starts

You could also attach a process outside of the debugger to the debugger, including processes on a remote device but your inspection ability is limited

You could also set process to automatically start in the debugger – useful for services and custom setup actions

When you have multiple processes, only one process is active in the debugger, but in order to switch between processes, you must be in break mode

When you switch to a process, all windows will show information for that process only

When you stop debugging, if the current process was launched from the debugger it will terminate, however if you attached the debugger to the current process (attach to a process outside of vs2017), the debugger will detach and leave that process running

Background

How can we debug the parallel program? bra bra bra... Our test environment is "visual studio 2015" and "Intel Parallel Studio XE 2016"

User Interface

Attach to Process dialog box

Processes window

Process window1

-shortcut

-how to open

-description/How to use

-info you can see

-what is attach

-what is detach

Threads window

Thread window1

-shortcut

-how to open

-description/how to use

-info you can see

Source window

Debug Location toolbar

Parallel Stacks window

Parallel Tasks window

Parallel Watch window

GPU Threads window

Walkthrough

Case A

project1: test1.cpp

#include <iostream>
using namespace std;

int main() {

#pragma omp parallel 
	{
#pragma omp for 

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

	     cout << " now i at test1= " << i << endl;
	}
}

Project2: test2.cpp

#include <iostream>
using namespace std;

int main() {

#pragma omp parallel 
	{
#pragma omp for 

	for (int j = 0; j < 10; j++)

	     cout << " now j at test2= " << j << endl;
	}
}

Case B

Case C

https://en.wikipedia.org/wiki/Help:Cheatsheet