- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
deterministic means when you compile for multiple times, the output produced should be identical.
gcc supports option -frandom-seed, which is useful in making deterministic build.
icc doesn't have such things? is there a way to make icc generate deterministic binary?
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I suppose you have thousands of possibilities to do that. I don't know what -frandom-seed exactly do, but definitely it's much better to use c++11 random functions. And init the random generator with the seed of your choice.
To solve your situation you can (what I usually do) set the seed as a parameter at execution time.
If you still want to have it at compilation time, you can easily use MY_SEED in the code and add in the compilation command -DMY_SEED=your_favorite_seed_value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@ Mathieu Gravey
Take a look at https://reproducible-builds.org/ to see the problem background.
The random seed is internally used in compiler to give a random name for functions in anonymous namespace. It has NOTING to do with my code logic.
The below code is taken from gcc:
/* Generate a name for a function unique to this translation unit.
TYPE is some string to identify the purpose of this function to the
linker or collect2. */
tree
get_file_function_name_long (const char *type)
{
...
/* We don't have anything that we know to be unique to this translation
unit, so use what we do have and throw in some randomness. */
...
sprintf (q + len, "_%08X_%08X", crc32_string (0, name),
crc32_string (0, flag_random_seed));
So you have an idea how compiler mangle names. My problem is intel C++ compiler support such things that I can use to make a deterministic build?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why not use a series of specific name spaces as opposed to letting the compiler generate one?
See responses in:
https://stackoverflow.com/questions/154469/unnamed-anonymous-namespaces-vs-static-functions
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@jimdempseyatthecove
even there is no anonymous namespaces, there will still be some randomly generated mangled names (e.g. for intel compiler, templates, not a case for gcc).
is there a way to tell interl compiler make it deterministic?

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