From 0edc082ff65cfa234cf428a146f4ec5ea8458ea4 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Sun, 20 Nov 2016 11:53:16 -0600 Subject: [PATCH] added new test for getting attribute 1. Added copyright to all new tests 2. Added test for hipDeviceGetAttribute Change-Id: I7a070c5b8316ef6575b3f4c49bda2769aea2a7c4 --- tests/src/nvcc/Device/hipChooseDevice.cpp | 19 ++++++++++ .../src/nvcc/Device/hipDeviceGetAttribute.cpp | 38 +++++++++++++++++++ tests/src/nvcc/Device/hipDeviceGetLimit.cpp | 19 ++++++++++ tests/src/nvcc/Device/hipGetDevice.cpp | 19 ++++++++++ tests/src/nvcc/Device/hipGetDeviceCount.cpp | 19 ++++++++++ .../nvcc/Device/hipGetDeviceProperties.cpp | 19 ++++++++++ tests/src/nvcc/Device/hipSetDevice.cpp | 19 ++++++++++ tests/src/nvcc/Device/hipSetDeviceFlags.cpp | 19 ++++++++++ 8 files changed, 171 insertions(+) create mode 100644 tests/src/nvcc/Device/hipDeviceGetAttribute.cpp diff --git a/tests/src/nvcc/Device/hipChooseDevice.cpp b/tests/src/nvcc/Device/hipChooseDevice.cpp index d2fbfe1852..3a64c6df33 100644 --- a/tests/src/nvcc/Device/hipChooseDevice.cpp +++ b/tests/src/nvcc/Device/hipChooseDevice.cpp @@ -1,3 +1,22 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + #include #include"test_common.h" diff --git a/tests/src/nvcc/Device/hipDeviceGetAttribute.cpp b/tests/src/nvcc/Device/hipDeviceGetAttribute.cpp new file mode 100644 index 0000000000..f0e56bf274 --- /dev/null +++ b/tests/src/nvcc/Device/hipDeviceGetAttribute.cpp @@ -0,0 +1,38 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include +#include"test_common.h" + +int main() +{ + int val; + hipDeviceAttr_t attr = hipDevAttrMaxThreadsPerBlock; + HIP_PRINT_STATUS(hipDeviceGetAttribute(NULL, attr, 0)); + HIP_PRINT_STATUS(hipDeviceGetAttribute(&val, attr, 0)); + HIP_PRINT_STATUS(hipDeviceGetAttribute(NULL, attr, -1)); + HIP_PRINT_STATUS(hipDeviceGetAttribute(&val, attr, -1)); + attr = 91; + + HIP_PRINT_STATUS(hipDeviceGetAttribute(NULL, attr, 0)); + HIP_PRINT_STATUS(hipDeviceGetAttribute(&val, attr, 0)); + HIP_PRINT_STATUS(hipDeviceGetAttribute(NULL, attr, -1)); + HIP_PRINT_STATUS(hipDeviceGetAttribute(&val, attr, -1)); + +} diff --git a/tests/src/nvcc/Device/hipDeviceGetLimit.cpp b/tests/src/nvcc/Device/hipDeviceGetLimit.cpp index b17d5d6a07..57b8594527 100644 --- a/tests/src/nvcc/Device/hipDeviceGetLimit.cpp +++ b/tests/src/nvcc/Device/hipDeviceGetLimit.cpp @@ -1,3 +1,22 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + #include #include "test_common.h" diff --git a/tests/src/nvcc/Device/hipGetDevice.cpp b/tests/src/nvcc/Device/hipGetDevice.cpp index a009e337a6..0e9e5d96f2 100644 --- a/tests/src/nvcc/Device/hipGetDevice.cpp +++ b/tests/src/nvcc/Device/hipGetDevice.cpp @@ -1,3 +1,22 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + #include #include "test_common.h" diff --git a/tests/src/nvcc/Device/hipGetDeviceCount.cpp b/tests/src/nvcc/Device/hipGetDeviceCount.cpp index ec02e57ae3..6565741b2f 100644 --- a/tests/src/nvcc/Device/hipGetDeviceCount.cpp +++ b/tests/src/nvcc/Device/hipGetDeviceCount.cpp @@ -1,3 +1,22 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + #include #include "test_common.h" diff --git a/tests/src/nvcc/Device/hipGetDeviceProperties.cpp b/tests/src/nvcc/Device/hipGetDeviceProperties.cpp index 944c4c1516..325d9dd410 100644 --- a/tests/src/nvcc/Device/hipGetDeviceProperties.cpp +++ b/tests/src/nvcc/Device/hipGetDeviceProperties.cpp @@ -1,3 +1,22 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + #include #include "test_common.h" diff --git a/tests/src/nvcc/Device/hipSetDevice.cpp b/tests/src/nvcc/Device/hipSetDevice.cpp index 7a473ef042..99c62a03be 100644 --- a/tests/src/nvcc/Device/hipSetDevice.cpp +++ b/tests/src/nvcc/Device/hipSetDevice.cpp @@ -1,3 +1,22 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + #include #include "test_common.h" diff --git a/tests/src/nvcc/Device/hipSetDeviceFlags.cpp b/tests/src/nvcc/Device/hipSetDeviceFlags.cpp index 398041b84a..e933ab56fa 100644 --- a/tests/src/nvcc/Device/hipSetDeviceFlags.cpp +++ b/tests/src/nvcc/Device/hipSetDeviceFlags.cpp @@ -1,3 +1,22 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + #include #include "test_common.h"