How do I compile a selected number of files with Intel C++ Compiler, and the rest of the Solution via Visual Studio 2005?

How do I compile a selected number of files with Intel C++ Compiler, and the rest of the Solution via Visual Studio 2005?

Hello,
I am using an open source code, and would like to try and parallelize it using Intel C++ Compiler. However, because the code seems to be written in a format that Intel C++ Compiler does not understand, it fails. Therefore, I was thinking of manually changing the format of the critical files only so that it can be compiled via Intel C++ Compiler, and leave the rest for Visual Studio 2005.

Is there a way to do that?

23 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Quoting - zgzg2020
Hello,
I am using an open source code, and would like to try and parallelize it using Intel C++ Compiler. However, because the code seems to be written in a format that Intel C++ Compiler does not understand, it fails. Therefore, I was thinking of manually changing the format of the critical files only so that it can be compiled via Intel C++ Compiler, and leave the rest for Visual Studio 2005.

Is there a way to do that?

I've never used this, but I think it should work:

1) Convert the Project with the files of interest to using Intel C++ (Right-click on the project in the solution explorer and select Use Intel C++). Now all files in the project will be compiled with Intel C++.

2) Right click on each C/C++ file in the project that you want to compile with MSVC and select Properties.

3) On the General page change the "Compiler and Environment Settings" from "Intel C++ Compiler" to "Microsoft Visual C++ Compiler".

That should do it. Now you have an Intel C++ project with some files compiled with Intel and others compiled with MS.

Peter

Quoting - pvonkaenel

I've never used this, but I think it should work:

1) Convert the Project with the files of interest to using Intel C++ (Right-click on the project in the solution explorer and select Use Intel C++). Now all files in the project will be compiled with Intel C++.

2) Right click on each C/C++ file in the project that you want to compile with MSVC and select Properties.

3) On the General page change the "Compiler and Environment Settings" from "Intel C++ Compiler" to "Microsoft Visual C++ Compiler".

That should do it. Now you have an Intel C++ project with some files compiled with Intel and others compiled with MS.

Peter

You can do this.

First, at the project level you need to right-click on the project / solutionand select use intel C++ projects. This will set the project or solution to use Intel C++. By default this will set the compiler to Intel C++ compiler for the project(s).

If you prefer that all files except a few files in the project (s) to be compile with MSVC by default,

right click on project (s) -> properties -> General -> intel specific -> Compiler and environment settings -> .

Once you do this all files by default will be compile by MS. You then can select the individual files, go through the same step and set the compiler for the file(s). File settings will override project settings.

That way, most of your files will be compile by MSVC, and some files will be compile by Intel.

Thank you guys for the quick solutions to my question!!! I will repost my feedback as soon as I have finished trying your suggestions out!

Thanx again!

Quoting - zgzg2020
Thank you guys for the quick solutions to my question!!! I will repost my feedback as soon as I have finished trying your suggestions out!

Thanx again!

Hello again,
I tried to do it in the steps you instructed. However, in step 2, when I right-click on individual files, and go to properties, the properties' page is different than solution properties' page. There is no General->Enviornment...etc. I cannot choose compiling individual files with a different compiler.

Could someone try it, and give me there feedback? Or, at least could someone kindly provide me with another way to do what I need?

Thanks again.

Quoting - zgzg2020

Hello again,
I tried to do it in the steps you instructed. However, in step 2, when I right-click on individual files, and go to properties, the properties' page is different than solution properties' page. There is no General->Enviornment...etc. I cannot choose compiling individual files with a different compiler.

Could someone try it, and give me there feedback? Or, at least could someone kindly provide me with another way to do what I need?

Thanks again.

See the attached image.

Peter

Attachments: 

AttachmentSize
Downloadimage/jpeg icpp_compiler_select.JPG41.2 KB

Quoting - pvonkaenel

See the attached image.

Peter

I see. Thank you for clearing that up. So, what I need to do is to follow your kind instructions above, and set the desired files to be compiled by their designated compiler using what I am seeing in the attached picture, right?

If I do as shown in the picture the file will be compiled by the setted compiler.

Quoting - zgzg2020

I see. Thank you for clearing that up. So, what I need to do is to follow your kind instructions above, and set the desired files to be compiled by their designated compiler using what I am seeing in the attached picture, right?

If I do as shown in the picture the file will be compiled by the setted compiler.

I believe that is correct.

Peter

You may verify which files got compiled by which compiler in the build-log.

Here is an example build-log output for one of my project:

Deleting intermediate files and output files for project 'Chess Knights Tour', configuration 'Debug|Win32'.
Compiling with Intel C++ Compiler 11.1.049 [IA-32]... (Intel C++ Environment)
Board.cpp
Square.cpp
Compiling with Visual C++... (Microsoft VC++ Environment)
ChessKnightsTour.cpp
Compiling manifest to resources... (Microsoft VC++ Environment)
Microsoft Windows Resource Compiler Version 6.0.5724.0

Copyright (C) Microsoft Corporation. All rights reserved.

Linking... (Intel C++ Environment)

- JD

Quoting - J.D. Patel (Intel)

You may verify which files got compiled by which compiler in the build-log.

Here is an example build-log output for one of my project:

Deleting intermediate files and output files for project 'Chess Knights Tour', configuration 'Debug|Win32'.
Compiling with Intel C++ Compiler 11.1.049 [IA-32]... (Intel C++ Environment)
Board.cpp
Square.cpp
Compiling with Visual C++... (Microsoft VC++ Environment)
ChessKnightsTour.cpp
Compiling manifest to resources... (Microsoft VC++ Environment)
Microsoft Windows Resource Compiler Version 6.0.5724.0

Copyright (C) Microsoft Corporation. All rights reserved.

Linking... (Intel C++ Environment)

- JD

Great! Thank you for that example. I will try it soon.

Quoting - pvonkaenel

I believe that is correct.

Peter

I am afraid I cannot find the Intel C++ Compiler amongst the choices available to me. How do I make it available?

Attachments: 

AttachmentSize
Downloadimage/jpeg icpp_compiler_non.JPG293.96 KB

Quoting - zgzg2020

I am afraid I cannot find the Intel C++ Compiler amongst the choices available to me. How do I make it available?

Did you convert the entire project over to Intel C++ first? You must do that to be able to decide between Intel C++ and MSVC.

Quoting - pvonkaenel

Did you convert the entire project over to Intel C++ first? You must do that to be able to decide between Intel C++ and MSVC.

So, I understand, that I must make the default to be Intel C++ first, and then exclude the ones I want to be compiled in VS, right?
But, I only need less than 10 files to be compiled in Intel C++, and over 200 files in VS... Is there any other way?

p.s. I will double check if the picture was under VS of Intel a little later.

Quoting - zgzg2020

So, I understand, that I must make the default to be Intel C++ first, and then exclude the ones I want to be compiled in VS, right?
But, I only need less than 10 files to be compiled in Intel C++, and over 200 files in VS... Is there any other way?

p.s. I will double check if the picture was under VS of Intel a little later.

As far as I know, you must convert the entire project to icc to be able to select the compiler on a per file bases. I tend to break my source into libraries where all files in a library are compiled with one compiler. Maybe your project can be similarly broken up.

In addition, you may select multiple files/projects simultaneously (selecting them while holding down the control key) and then right-click -> Properties to go on to select compiler for all those selected in one shot! This will speed up your compiler selection ;-)

- J.D. Patel

Quoting - J.D. Patel (Intel)

In addition, you may select multiple files/projects simultaneously (selecting them while holding down the control key) and then right-click -> Properties to go on to select compiler for all those selected in one shot! This will speed up your compiler selection ;-)

- J.D. Patel

Yeah, that works. But, its quiet time consuming with the large project I am compiling.

Quoting - pvonkaenel

As far as I know, you must convert the entire project to icc to be able to select the compiler on a per file bases. I tend to break my source into libraries where all files in a library are compiled with one compiler. Maybe your project can be similarly broken up.

When I made the icc as the default compiler the choices as described in your picture appeared. However, I have noticed that the header files remain having the same choices as before. Moreover, when I highlight a CPP file with a Header file I get reverted back to having the Header file choices.
1. What choice would be suitable for me?
2. Could some explain the meaning of those choices?

Attachments: 

AttachmentSize
Downloadimage/jpeg cpp.JPG153.7 KB
Downloadimage/jpeg cppANDh.JPG355.13 KB
Downloadimage/jpeg h.JPG175.84 KB

Quoting - zgzg2020

When I made the icc as the default compiler the choices as described in your picture appeared. However, I have noticed that the header files remain having the same choices as before. Moreover, when I highlight a CPP file with a Header file I get reverted back to having the Header file choices.
1. What choice would be suitable for me?
2. Could some explain the meaning of those choices?

Since the header files are not compiled directly, you should be able to just leave them alone. They will be included by your CPP files which can now be compiled by either icc or mscc depending on your selection, so they will effectively adapt. You may even see different warnings in the headers depending on which CPP files include it (which will depend on which compiler is being used for the CPP files).

I think you're done.

Peter

Quoting - zgzg2020
Hello,
I am using an open source code, and would like to try and parallelize it using Intel C++ Compiler. However, because the code seems to be written in a format that Intel C++ Compiler does not understand, it fails. Therefore, I was thinking of manually changing the format of the critical files only so that it can be compiled via Intel C++ Compiler, and leave the rest for Visual Studio 2005.

Is there a way to do that?

Good that you're able to tweak your project/file properties to meet your needs as you mentioned in original post.

Just curious:
May I ask you which open source code is this that fails to compile using Intel compiler?

Thanks.
- J.D. Patel

Quoting - J.D. Patel (Intel)

Good that you're able to tweak your project/file properties to meet your needs as you mentioned in original post.

Just curious:
May I ask you which open source code is this that fails to compile using Intel compiler?

Thanks.
- J.D. Patel

Yes, of course you may! : ) It's a Half-Life2 mod created by Source SDK. Source SDK is a kit released by Valve for modding their games.

Guys, I have some good news and some bad news. The good news is that I was able to do what I originally wanted, which was compiling the selected file using my designated complier. The bad news it failed horribly. And, I lack the time and the energy to try and fix it. So, I have decided to place this plan on hold. But, I want to come back to it later, few months later maybe.

Thank you guys for all the help. I truly appreciate it!!!

Quoting - J.D. Patel (Intel)

Good that you're able to tweak your project/file properties to meet your needs as you mentioned in original post.

Just curious:
May I ask you which open source code is this that fails to compile using Intel compiler?

Thanks.
- J.D. Patel

Yes, of course you may! : ) It's a Half-Life2 mod created by Source SDK. Source SDK is a kit released by Valve for modding their games.

Guys, I have some good news and some bad news. The good news is that I was able to do what I originally wanted, which was compiling the selected file using my designated complier. The bad news it failed horribly. And, I lack the time and the energy to try and fix it. So, I have decided to place this plan on hold. But, I want to come back to it later, few months later maybe.

Thank you guys for all the help. I truly appreciate it!!!

Quoting - zgzg2020

Yes, of course you may! : ) It's a Half-Life2 mod created by Source SDK. Source SDK is a kit released by Valve for modding their games.

Guys, I have some good news and some bad news. The good news is that I was able to do what I originally wanted, which was compiling the selected file using my designated complier. The bad news it failed horribly. And, I lack the time and the energy to try and fix it. So, I have decided to place this plan on hold. But, I want to come back to it later, few months later maybe.

Thank you guys for all the help. I truly appreciate it!!!

Sorry to hear that you ran into compilation issues.
Just curious - they all compiled OK till you selctively changed compiler for some - is that right?
When you get a chance to post them here, we can discuss them.

- J.D. patel

http://software.intel.com/en-us/articles/intel-c-compiler-compatibility-...

This link has a section on mixing Intel and Microsoft compilers along with other IDE integration features.

Leave a Comment

Please sign in to add a comment. Not a member? Join today