- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All!
I have VS2013+Intel Parallel Studio XE 2015+TBB 4.3
My current code has many functions that has local stack allocations by exampe
void fnc() {
int arr[1024];
.............
}
when I started use fnc() in parallel for (it is some form of parallel execution) I got bad concurrent perfomance according to VTune analyser
I done some replacement for the code: int *arr = malloc(sizeof(int) * 1024). malloc I got versus from tbb of course. In the result I got very good concurrent execution. Really I can't understand why local stack allocation has concurrency problems. Can anyone describe the problem? Has this issue easy solution?
Thanks! Sorry for my bad english!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the speed differs, but the results are correct, then suspect it is an alignment issue. You can align the stack local array using:
Windows* OS:
__declspec(align(16)) int arr[1024];
Linux* OS:
int arr[1024] __attribute__((aligned(16)));
FWIW I whish the standards committee would adopt a uniform way of doing this.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for pointing this out to me. Now I can start modernizing my alignment directives/attributes.
It still bugs me that C++11 and C11 use different keywords, same issue with __int32, int32_t, int32, etc...
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your replies. I tested alignment directives but without any changes in the results.
I tried to create the simple example to show the issue more detailed but I found that all is not so simple and easy. I will investigate it and give you back with additional info if my question still is actual

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