From 81bc82d16604b29eafc6b22f7fd2585383cca053 Mon Sep 17 00:00:00 2001 From: sunway513 Date: Mon, 24 Jul 2017 17:16:13 +0000 Subject: [PATCH 1/4] Fix indentation, binary path and add wait on popen calls to hipEnvVar test --- tests/src/hipEnvVarDriver.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/src/hipEnvVarDriver.cpp b/tests/src/hipEnvVarDriver.cpp index 1edb158aa3..dc1d451e0d 100644 --- a/tests/src/hipEnvVarDriver.cpp +++ b/tests/src/hipEnvVarDriver.cpp @@ -28,16 +28,21 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include "hip/hip_runtime.h" +#include +#include using namespace std; int getDeviceNumber(){ - FILE *in; - char buff[512]; - string str; - if(!(in = popen("./hipEnvVar -c", "r"))){ - return 1; + FILE *in; + char buff[512]; + string str; + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + if(!(in = popen("./directed_tests/hipEnvVar -c", "r"))){ + return 1; + } + while(fgets(buff, sizeof(buff), in)!=NULL){ + cout << buff; } - fgets(buff, sizeof(buff), in); pclose(in); return atoi(buff); } @@ -46,12 +51,15 @@ int getDeviceNumber(){ int getDevicePCIBusNumRemote(int deviceID){ FILE *in; char buff[512]; - string str = "./hipEnvVar -d "; + string str = "./directed_tests/hipEnvVar -d "; str += std::to_string(deviceID); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); if(!(in = popen(str.c_str(), "r"))){ return 1; } - fgets(buff, sizeof(buff), in); + while(fgets(buff, sizeof(buff), in)!=NULL){ + cout << buff; + } pclose(in); return atoi(buff); } From 1275ceed675dd4db0175e765a7224098f1c4543d Mon Sep 17 00:00:00 2001 From: sunway513 Date: Mon, 24 Jul 2017 18:53:46 +0000 Subject: [PATCH 2/4] Re-enable hipEnvVarDriver in Jenkinsfile --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 42f8b67c3c..08fea0b0bb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -119,7 +119,6 @@ def docker_build_inside_image( def build_image, String inside_args, String platf cd ${build_dir_rel} make install -j\$(nproc) make build_tests -j\$(nproc) - ctest -E hipEnvVarDriver """ // If unit tests output a junit or xunit file in the future, jenkins can parse that file // to display test results on the dashboard From 6f359dfbe66aecc1be2b8665ae316831ee1a43a7 Mon Sep 17 00:00:00 2001 From: sunway513 Date: Mon, 24 Jul 2017 19:02:00 +0000 Subject: [PATCH 3/4] Update Jenkinsfile to run all the built tests --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 08fea0b0bb..526a825c65 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -119,6 +119,7 @@ def docker_build_inside_image( def build_image, String inside_args, String platf cd ${build_dir_rel} make install -j\$(nproc) make build_tests -j\$(nproc) + make test """ // If unit tests output a junit or xunit file in the future, jenkins can parse that file // to display test results on the dashboard From ed0d6cf7454d792d3d2edd7ac72dcee07b5dc974 Mon Sep 17 00:00:00 2001 From: sunway513 Date: Thu, 27 Jul 2017 17:41:49 +0000 Subject: [PATCH 4/4] Change to use hipDeviceGetPCIBusId api for hipEnvVarDriver test --- tests/src/hipEnvVar.cpp | 15 ++++++------- tests/src/hipEnvVarDriver.cpp | 42 +++++++++++++++++------------------ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/tests/src/hipEnvVar.cpp b/tests/src/hipEnvVar.cpp index d5942518e0..ff68103816 100644 --- a/tests/src/hipEnvVar.cpp +++ b/tests/src/hipEnvVar.cpp @@ -109,15 +109,14 @@ int main(int argc, char **argv) std::cout << devCount << std::endl; } if (retDevInfo) { - hipSetDevice(device); - hipDeviceProp_t devProp; + hipDevice_t deviceT; + hipDeviceGet(&deviceT, device); - hipGetDeviceProperties(&devProp, device); - if (devProp.major < 1) { - printf("%d does not support HIP\n", device); - return -1; - } - std::cout << devProp.pciBusID << std::endl; + char pciBusId[100]; + memset(pciBusId,0,100); + hipDeviceGetPCIBusId(pciBusId,100,deviceT); + + cout< devPCINum; + char pciBusID[100]; //collect the device pci bus ID for all devices int totalDeviceNum = getDeviceNumber(); std::cout << "The total number of available devices is " << totalDeviceNum<< std::endl <<"Valid index range is 0 - "< devPCINum; for (int i = 0; i < totalDeviceNum ; i++) { - devPCINum.push_back(getDevicePCIBusNum(i)); + getDevicePCIBusNum(i, pciBusID); + devPCINum.push_back(pciBusID); std::cout <<"The collected device PCI Bus ID of Device "<