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

I have symptoms very similar to this post : http://software.intel.com/en-us/forums/showthread.php?t=76294

I'm building a DLL which plugs in to another application and I'm trying to use MKL VML goodness to speed up some exponential calculations.

The DLL is built with the multi-threaded DLL flag (/MD) and i'm linking against mkl_sequential_dll.lib mkl_intel_c.lib mkl_core.lib

however whenever I call vsExp in code which is multithreaded using TBB i get a big old crash. I've tried all the combinations I can think of {mkl_sequential.lib, mkl_intel_thead.lib, mkl_intel_thead_dll.lib} and it's always a crash, sometimes it's a straight out kill the entire program crash and sometimes it is the same openMP problem that was reported in the above thread.

"OMP: Error #134: Cannot set thread affinity mask. OMP: System error #87: The parameter is incorrect."

I'm using the MKL that comes with Intel compiler 11.1.065 (but the actual compiler is version 11.1.071 - there is no separate MKL with this version)... and I'm using TBB 3.0 with a simple parallel_for - the memory for both the input and output are thread local.

What am I doing wrong?

Link Copied

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

--Vipin

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

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

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

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

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

Call Count Average Time Total Time Regular exponential 1 408 408 MKL exponential 1 18 18 TBB exponential 1 138 138 TBB+MKL exponential 1 8 8

namespace OtUtils { templateinline void vectorExp(vector & in, vector & out); }; template<> void OTUtils::vectorExp (vector & in, vector & out) { vsExp(in.size(),&(in[0]),&(out[0])); } template<> void OTUtils::vectorExp (vector & in, vector & out) { vdExp(in.size(),&(in[0]),&(out[0])); } template T OTUtils::calcUsage(vector & costs, vector & usage, T phi) { T totalUtility = 0.0; T minCost = vectorMin(costs); int numOptions = costs.size(); vector utility(numOptions, 0.0); vector normCost(numOptions); usage.resize(numOptions, 0.0); for (int i = 0; i < numOptions; ++i) { normCost.at(i) = (costs.at(i) == numeric_limits ::infinity()) ? -numeric_limits ::infinity() : phi * (costs.at(i) - minCost); } // This calls to VML and crashes everything vectorExp(normCost, utility); // This call does the same function as the above line, but doesn't crash // for (int i=0; i < numOptions; i++) utility.at(i)=exp(normCost.at(i)); }

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

[cpp] // If I allocate my memory myself, it works! // T* utility = (T*)_aligned_malloc(sizeof(T)*numOptions, 16); // T* utility = new T[numOptions]; // If I let vector allocate my memory... it crashes vectorOnce again, any help here is appreciated.utility(numOptions); // populate the utility vector with values for (int i = 0; i < numOptions; ++i) { utility = (costs== numeric_limits::infinity()) ? -numeric_limits ::infinity() : phi * (costs - minCost); } // transform the utility in place (to it's exponential) // NOTE: this is the same form for both vectorand T[] vsExp(numOptions, &(utility[0]), &(utility[0]));[/cpp]

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

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

One more question, if you replace

vsExp(numOptions,&(utility[0]),&(utility[0]));

with

for(i=0;i

*(&(utility[0])+i) =expf(*(&(utility[0])+i) );

}

Will it work?

Also, whereare your STL headers from?

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

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

*= exp(utility*

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

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

[cpp](int i=0; i= exp(vec ); // 2min 34sec through critical section vsExp(vec_size, &(vec[0]), &(vec[0])) // 2min 38sec through critical section[/cpp]

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

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

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

icl main.cpp mkl_intel_c.lib mkl_sequential.lib mkl_core.lib

This code works on my side and I see no crash of any kind. Does it work on your side? What should be changed here for it to crash as in your case?

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