-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These test cases are derived from the generic tests written by Nick Park and placed in the public domain (https://github.com/nspark/shmemx). Note: covers some, but not all of the new generic API. Signed-off-by: James Dinan <[email protected]>
- Loading branch information
James Dinan
committed
Feb 10, 2016
1 parent
e12bb15
commit b98e8e9
Showing
9 changed files
with
637 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* This test program is derived from a unit test created by Nick Park. | ||
* The original unit test is a work of the U.S. Government and is not subject | ||
* to copyright protection in the United States. Foreign copyrights may | ||
* apply. | ||
* | ||
* Copyright (c) 2016 Intel Corporation. All rights reserved. | ||
* This software is available to you under the BSD license below: | ||
* | ||
* Redistribution and use in source and binary forms, with or | ||
* without modification, are permitted provided that the following | ||
* conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer. | ||
* | ||
* - Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials | ||
* provided with the distribution. | ||
* | ||
* 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 <stdlib.h> | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <stdio.h> | ||
#include <shmem.h> | ||
|
||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) | ||
|
||
#define TEST_SHMEM_ADD(TYPE) \ | ||
do { \ | ||
static TYPE remote = (TYPE)0; \ | ||
const int mype = shmem_my_pe(); \ | ||
const int npes = shmem_n_pes(); \ | ||
for (int i = 0; i < npes; i++) \ | ||
shmem_add(&remote, (TYPE)(mype + 1), i); \ | ||
shmem_barrier_all(); \ | ||
if (remote != (TYPE)(npes * (npes + 1) / 2)) { \ | ||
fprintf(stderr, \ | ||
"PE %i observed error with shmem_add(%s, ...)\n", \ | ||
mype, #TYPE); \ | ||
rc = EXIT_FAILURE; \ | ||
} \ | ||
} while (false) | ||
|
||
#else | ||
#define TEST_SHMEM_ADD(TYPE) | ||
|
||
#endif | ||
|
||
int main(int argc, char* argv[]) { | ||
shmem_init(); | ||
|
||
int rc = EXIT_SUCCESS; | ||
TEST_SHMEM_ADD(int); | ||
TEST_SHMEM_ADD(long); | ||
TEST_SHMEM_ADD(long long); | ||
|
||
shmem_finalize(); | ||
return rc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* This test program is derived from a unit test created by Nick Park. | ||
* The original unit test is a work of the U.S. Government and is not subject | ||
* to copyright protection in the United States. Foreign copyrights may | ||
* apply. | ||
* | ||
* Copyright (c) 2016 Intel Corporation. All rights reserved. | ||
* This software is available to you under the BSD license below: | ||
* | ||
* Redistribution and use in source and binary forms, with or | ||
* without modification, are permitted provided that the following | ||
* conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer. | ||
* | ||
* - Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials | ||
* provided with the distribution. | ||
* | ||
* 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 <stdlib.h> | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <stdio.h> | ||
#include <shmem.h> | ||
|
||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) | ||
|
||
#define TEST_SHMEM_FETCH(TYPE) \ | ||
do { \ | ||
static TYPE remote; \ | ||
const int mype = shmem_my_pe(); \ | ||
const int npes = shmem_n_pes(); \ | ||
remote = (TYPE)mype; \ | ||
shmem_barrier_all(); \ | ||
TYPE val = shmem_fetch(&remote, (mype + 1) % npes); \ | ||
if (val != (TYPE)((mype + 1) % npes)) { \ | ||
fprintf(stderr, \ | ||
"PE %i received incorrect value " \ | ||
"for shmem_fetch(%s, ...)\n", mype, #TYPE); \ | ||
rc = EXIT_FAILURE; \ | ||
} \ | ||
} while (false) | ||
|
||
#else | ||
#define TEST_SHMEM_FETCH(TYPE) | ||
|
||
#endif | ||
|
||
int main(int argc, char* argv[]) { | ||
shmem_init(); | ||
|
||
int rc = EXIT_SUCCESS; | ||
TEST_SHMEM_FETCH(float); | ||
TEST_SHMEM_FETCH(double); | ||
TEST_SHMEM_FETCH(int); | ||
TEST_SHMEM_FETCH(long); | ||
TEST_SHMEM_FETCH(long long); | ||
|
||
shmem_finalize(); | ||
return rc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* This test program is derived from a unit test created by Nick Park. | ||
* The original unit test is a work of the U.S. Government and is not subject | ||
* to copyright protection in the United States. Foreign copyrights may | ||
* apply. | ||
* | ||
* Copyright (c) 2016 Intel Corporation. All rights reserved. | ||
* This software is available to you under the BSD license below: | ||
* | ||
* Redistribution and use in source and binary forms, with or | ||
* without modification, are permitted provided that the following | ||
* conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer. | ||
* | ||
* - Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials | ||
* provided with the distribution. | ||
* | ||
* 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 <stdlib.h> | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <stdio.h> | ||
#include <shmem.h> | ||
|
||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) | ||
|
||
#define TEST_SHMEM_G(TYPE) \ | ||
do { \ | ||
static TYPE remote; \ | ||
const int mype = shmem_my_pe(); \ | ||
const int npes = shmem_n_pes(); \ | ||
remote = (TYPE)mype; \ | ||
shmem_barrier_all(); \ | ||
TYPE val = shmem_g(&remote, (mype + 1) % npes); \ | ||
if (val != (TYPE)((mype + 1) % npes)) { \ | ||
fprintf(stderr, \ | ||
"PE %i received incorrect value " \ | ||
"for shmem_g(%s, ...)\n", mype, #TYPE); \ | ||
rc = EXIT_FAILURE; \ | ||
} \ | ||
} while (false) | ||
|
||
#else | ||
#define TEST_SHMEM_G(TYPE) | ||
|
||
#endif | ||
|
||
int main(int argc, char* argv[]) { | ||
shmem_init(); | ||
|
||
int rc = EXIT_SUCCESS; | ||
TEST_SHMEM_G(float); | ||
TEST_SHMEM_G(double); | ||
TEST_SHMEM_G(long double); | ||
TEST_SHMEM_G(char); | ||
TEST_SHMEM_G(short); | ||
TEST_SHMEM_G(int); | ||
TEST_SHMEM_G(long); | ||
TEST_SHMEM_G(long long); | ||
|
||
shmem_finalize(); | ||
return rc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* This test program is derived from a unit test created by Nick Park. | ||
* The original unit test is a work of the U.S. Government and is not subject | ||
* to copyright protection in the United States. Foreign copyrights may | ||
* apply. | ||
* | ||
* Copyright (c) 2016 Intel Corporation. All rights reserved. | ||
* This software is available to you under the BSD license below: | ||
* | ||
* Redistribution and use in source and binary forms, with or | ||
* without modification, are permitted provided that the following | ||
* conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer. | ||
* | ||
* - Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials | ||
* provided with the distribution. | ||
* | ||
* 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 <stdlib.h> | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <stdio.h> | ||
#include <shmem.h> | ||
|
||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) | ||
|
||
#define TEST_SHMEM_GET(TYPE) \ | ||
do { \ | ||
static TYPE remote[10]; \ | ||
const int mype = shmem_my_pe(); \ | ||
const int npes = shmem_n_pes(); \ | ||
TYPE local[10]; \ | ||
for (int i = 0; i < 10; i++) \ | ||
remote[i] = (TYPE)mype; \ | ||
shmem_barrier_all(); \ | ||
shmem_get(local, remote, 10, (mype + 1) % npes); \ | ||
for (int i = 0; i < 10; i++) \ | ||
if (local[i] != (TYPE)((mype + 1) % npes)) { \ | ||
fprintf(stderr, \ | ||
"PE %i received incorrect value " \ | ||
"for shmem_get(%s,...)\n", mype, #TYPE); \ | ||
rc = EXIT_FAILURE; \ | ||
} \ | ||
} while (false) | ||
|
||
#else | ||
#define TEST_SHMEM_GET(TYPE) | ||
|
||
#endif | ||
|
||
int main(int argc, char* argv[]) { | ||
shmem_init(); | ||
|
||
int rc = EXIT_SUCCESS; | ||
TEST_SHMEM_GET(float); | ||
TEST_SHMEM_GET(double); | ||
TEST_SHMEM_GET(long double); | ||
TEST_SHMEM_GET(char); | ||
TEST_SHMEM_GET(short); | ||
TEST_SHMEM_GET(int); | ||
TEST_SHMEM_GET(long); | ||
TEST_SHMEM_GET(long long); | ||
|
||
shmem_finalize(); | ||
return rc; | ||
} |
Oops, something went wrong.