@@ -25,6 +25,7 @@ THE SOFTWARE.
25
25
26
26
#include " hipBin_base.h"
27
27
#include " hipBin_util.h"
28
+ #include < iostream>
28
29
#include < vector>
29
30
#include < string>
30
31
#include < unordered_set>
@@ -296,7 +297,7 @@ string HipBinAmd::getCompilerVersion() {
296
297
}
297
298
}
298
299
} else {
299
- cout << " Hip Clang Compiler not found" << endl;
300
+ std::cerr << " Hip Clang Compiler not found" << endl;
300
301
}
301
302
return complierVersion;
302
303
}
@@ -379,7 +380,7 @@ bool HipBinAmd::detectPlatform() {
379
380
var.hipPlatformEnv_ == " hcc" ) {
380
381
detected = true ;
381
382
if (var.hipPlatformEnv_ == " hcc" )
382
- cout <<
383
+ std::cerr <<
383
384
" Warning: HIP_PLATFORM=hcc is deprecated." <<
384
385
" Please use HIP_PLATFORM=amd." << endl;
385
386
}
@@ -425,7 +426,7 @@ void HipBinAmd::checkHipconfig() {
425
426
cout << endl << " Check system installation: " << endl;
426
427
cout << " check hipconfig in PATH..." << endl;
427
428
if (system (" which hipconfig > /dev/null 2>&1" ) != 0 ) {
428
- cout << " FAIL " << endl;
429
+ std::cerr << " FAIL " << endl;
429
430
} else {
430
431
cout << " good" << endl;
431
432
}
@@ -436,7 +437,7 @@ void HipBinAmd::checkHipconfig() {
436
437
cout << " check LD_LIBRARY_PATH (" << ldLibraryPath <<
437
438
" ) contains HSA_PATH (" << hsaPath << " )..." << endl;
438
439
if (ldLibraryPath.find (hsaPath) == string::npos) {
439
- cout << " FAIL" << endl;
440
+ std::cerr << " FAIL" << endl;
440
441
} else {
441
442
cout << " good" << endl;
442
443
}
@@ -619,8 +620,8 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
619
620
string pattern = " ^" + targetOpt + " .*" ;
620
621
if (hipBinUtilPtr_->stringRegexMatch (arg, pattern)) {
621
622
if (targetOpt == " --amdgpu-target=" ) {
622
- cout << " Warning: The --amdgpu-target option has been deprecated and will be removed in the future."
623
- << " Use --offload-arch instead.\n " ;
623
+ std::cerr << " Warning: The --amdgpu-target option has been deprecated and will be removed in the future."
624
+ << " Use --offload-arch instead.\n " ;
624
625
}
625
626
// If targets string is not empty,
626
627
// add a comma before adding new target option value.
@@ -669,8 +670,8 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
669
670
}
670
671
if (hipBinUtilPtr_->substringPresent (
671
672
arg, " --amdhsa-code-object-version=" )) {
672
- cout << " Warning: The --amdhsa-code-object-version option has been deprecated and will be removed in the future."
673
- << " Use -mllvm -mcode-object-version instead.\n " ;
673
+ std::cerr << " Warning: The --amdhsa-code-object-version option has been deprecated and will be removed in the future."
674
+ << " Use -mllvm -mcode-object-version instead.\n " ;
674
675
arg = hipBinUtilPtr_->replaceStr (
675
676
arg, " --amdhsa-code-object-version=" , " " );
676
677
hsacoVersion = arg;
@@ -689,7 +690,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
689
690
string file = split_arg.at (1 );
690
691
ifstream in (file);
691
692
if (!in.is_open ()) {
692
- cout << " unable to open file for reading: " << file << endl;
693
+ std::cerr << " unable to open file for reading: " << file << endl;
693
694
exit (-1 );
694
695
}
695
696
string new_arg;
@@ -698,7 +699,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
698
699
new_file /= " response_file" ;
699
700
ofstream out (new_file);
700
701
if (!out.is_open ()) {
701
- cout << " unable to open file for writing: " <<
702
+ std::cerr << " unable to open file for writing: " <<
702
703
new_file.string () << endl;
703
704
exit (-1 );
704
705
}
@@ -884,10 +885,10 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
884
885
if (hipBinUtilPtr_->stringRegexMatch (arg, " ^--hipcc.*" )) {
885
886
swallowArg = 1 ;
886
887
if (arg == " --hipcc-func-supp" ) {
887
- cout << " Warning: The --hipcc-func-supp option has been deprecated and will be removed in the future.\n " ;
888
+ std::cerr << " Warning: The --hipcc-func-supp option has been deprecated and will be removed in the future.\n " ;
888
889
funcSupp = 1 ;
889
890
} else if (arg == " --hipcc-no-func-supp" ) {
890
- cout << " Warning: The --hipcc-no-func-supp option has been deprecated and will be removed in the future.\n " ;
891
+ std::cerr << " Warning: The --hipcc-no-func-supp option has been deprecated and will be removed in the future.\n " ;
891
892
funcSupp = 0 ;
892
893
}
893
894
} else {
@@ -981,7 +982,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
981
982
// does not check if the device supports the feature or not
982
983
// e.g. vega10 does not support sramecc
983
984
if (knownFeatures.find (procAndFeatures.at (i)) == knownFeatures.end ()) {
984
- cout << " Warning: The Feature: " << procAndFeatures.at (i) <<
985
+ std::cerr << " Warning: The Feature: " << procAndFeatures.at (i) <<
985
986
" is unknown. Correct compilation is not guaranteed.\n " ;
986
987
}
987
988
}
@@ -1006,8 +1007,8 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
1006
1007
// rocm_agent_enumerator failed! Throw an error and die if linking is required
1007
1008
if (default_amdgpu_target == 1 && compileOnly == 0 ) {
1008
1009
// TODO(agunashe) exit from function
1009
- cout << " No valid AMD GPU target was either specified or found."
1010
- << " Please specify a valid target using --offload-arch=<target>.\n " ;
1010
+ std::cerr << " No valid AMD GPU target was either specified or found."
1011
+ << " Please specify a valid target using --offload-arch=<target>.\n " ;
1011
1012
}
1012
1013
HCC_EXTRA_LIBRARIES =" \n " ; // TODO(agunashe) write to env
1013
1014
@@ -1119,7 +1120,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
1119
1120
string cmdOut = sysOut.out ;
1120
1121
int CMD_EXIT_CODE = sysOut.exitCode ;
1121
1122
if (CMD_EXIT_CODE !=0 ) {
1122
- cout << " failed to execute:" << CMD << std::endl;
1123
+ std::cerr << " failed to execute:" << CMD << std::endl;
1123
1124
}
1124
1125
exit (CMD_EXIT_CODE);
1125
1126
} // end of runCmd section
0 commit comments