Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

CWhit10

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-18-2015
09:34 PM

63 Views

Hi,

I used Inspector XE to run analysis on a matrix multiplication algorithm, where matrix *C = A x B*.

Matrices A, B, and C are initialized using dynamic memory allocation. Race condition problem was detected at line *80*.

80 #pragma omp parallel shared (A, B, TEMP) private(i, j) 81 { 82 83 #pragma omp for 84 for (i=0 ; i<N ; i++) 85 { 86 for (j=0 ; j<N ; j++) 87 { 88 A= i + 1; 89 B = i + j; 90 } 91 } 92 }

However, the final result (*printf* result), which is the content of matrix C is correct.

I thought that race condition would cause the final result wrong, but the opposite happened. Why?

Thank you.

Link Copied

Accepted Solutions

Peter_W_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-19-2015
01:50 AM

63 Views

I tried to reproduce this problem with your piece of example code (please see my attachment, matrix_multiply.c), but the problem was not found.

Could it be due to different compiler version or inspector version?

# icc -g -openmp matrix_multiply.c -qopt-report -qopt-report-file=stdout -o matrix_multiply -lpthread

Intel(R) Advisor can now assist with vectorization and show optimization

report messages with your source code.

See "https://software.intel.com/en-us/intel-advisor-xe" for details.

Report from: OpenMP optimizations [openmp]

matrix_multiply.c(12:1-12:1):OMP:Initalzie: OpenMP DEFINED REGION WAS PARALLELIZED

Report from: OpenMP optimizations [openmp]

matrix_multiply.c(33:1-33:1):OMP:multiply: OpenMP DEFINED REGION WAS PARALLELIZED

# ./matrix_multiply

# inspxe-cl -c ti3 -- ./matrix_multiply

0 new problem(s) found

# icc -V

Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.0.109 Build 20150815

Copyright (C) 1985-2015 Intel Corporation. All rights reserved.

# inspxe-cl -version

Intel(R) Inspector XE 2016 (build 423441) Command Line tool

Copyright (C) 2009-2015 Intel Corporation. All rights reserved.

2 Replies

Peter_W_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-19-2015
01:50 AM

64 Views

I tried to reproduce this problem with your piece of example code (please see my attachment, matrix_multiply.c), but the problem was not found.

Could it be due to different compiler version or inspector version?

# icc -g -openmp matrix_multiply.c -qopt-report -qopt-report-file=stdout -o matrix_multiply -lpthread

Intel(R) Advisor can now assist with vectorization and show optimization

report messages with your source code.

See "https://software.intel.com/en-us/intel-advisor-xe" for details.

Report from: OpenMP optimizations [openmp]

matrix_multiply.c(12:1-12:1):OMP:Initalzie: OpenMP DEFINED REGION WAS PARALLELIZED

Report from: OpenMP optimizations [openmp]

matrix_multiply.c(33:1-33:1):OMP:multiply: OpenMP DEFINED REGION WAS PARALLELIZED

# ./matrix_multiply

# inspxe-cl -c ti3 -- ./matrix_multiply

0 new problem(s) found

# icc -V

Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.0.109 Build 20150815

Copyright (C) 1985-2015 Intel Corporation. All rights reserved.

# inspxe-cl -version

Intel(R) Inspector XE 2016 (build 423441) Command Line tool

Copyright (C) 2009-2015 Intel Corporation. All rights reserved.

Peter_W_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-19-2015
01:53 AM

63 Views

For more complete information about compiler optimizations, see our Optimization Notice.