-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: James Dinan <[email protected]>
- Loading branch information
James Dinan
committed
Feb 26, 2018
1 parent
dbf4309
commit 7eabeae
Showing
151 changed files
with
23,273 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- Makefile -*- | ||
# | ||
# Copyright 2011 Sandia Corporation. Under the terms of Contract | ||
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government | ||
# retains certain rights in this software. | ||
# | ||
# Copyright (c) 2017 Intel Corporation. All rights reserved. | ||
# This software is available to you under the BSD license. | ||
# | ||
# This file is part of the Sandia OpenSHMEM software package. For license | ||
# information, see the LICENSE file in the top level directory of the | ||
# distribution. | ||
|
||
SUBDIRS = unit performance apps |
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,58 @@ | ||
# -*- Makefile -*- | ||
# | ||
# Copyright 2011 Sandia Corporation. Under the terms of Contract | ||
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government | ||
# retains certain rights in this software. | ||
# | ||
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights reserved. | ||
# | ||
# Copyright (c) 2017 Intel Corporation. All rights reserved. | ||
# This software is available to you under the BSD license. | ||
# | ||
# This file is part of the Sandia OpenSHMEM software package. For license | ||
# information, see the LICENSE file in the top level directory of the | ||
# distribution. | ||
|
||
NPROCS ?= 2 | ||
LOG_COMPILER = $(TEST_RUNNER) | ||
|
||
AM_LDFLAGS = $(LIBTOOL_WRAPPER_LDFLAGS) | ||
|
||
check_PROGRAMS = \ | ||
binary-search \ | ||
gups | ||
|
||
SHORT_TESTS = \ | ||
binary-search \ | ||
gups | ||
|
||
if HAVE_PTHREADS | ||
check_PROGRAMS += \ | ||
mandelbrot | ||
|
||
SHORT_TESTS += \ | ||
mandelbrot | ||
endif | ||
|
||
if ENABLE_LENGTHY_TESTS | ||
TESTS = $(check_PROGRAMS) | ||
else | ||
TESTS = $(SHORT_TESTS) | ||
endif | ||
|
||
if EXTERNAL_TESTS | ||
bin_PROGRAMS = $(check_PROGRAMS) | ||
AM_CPPFLAGS = | ||
LDADD = | ||
else | ||
AM_CPPFLAGS = -I$(top_builddir)/mpp | ||
LDADD = $(top_builddir)/src/libsma.la | ||
endif | ||
|
||
if USE_PMI_SIMPLE | ||
LDADD += $(top_builddir)/pmi-simple/libpmi_simple.la | ||
endif | ||
|
||
mandelbrot_LDFLAGS = $(PTHREAD_LIBS) | ||
mandelbrot_CFLAGS = -I$(top_srcdir)/test/unit $(PTHREAD_CFLAGS) | ||
mandelbrot_LDADD = $(LDADD) $(PTHREAD_CFLAGS) |
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,82 @@ | ||
/* | ||
* Copyright (c) 2017 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 <stdio.h> | ||
#include <shmem.h> | ||
|
||
#define N_PER_PE 10 | ||
|
||
/* N_PER_PE*N_PES sorted, distributed shared array */ | ||
int keys[N_PER_PE]; | ||
|
||
static int binary_search(int key) { | ||
int low, mid, high; | ||
|
||
low = 0; | ||
high = shmem_n_pes()*N_PER_PE; | ||
|
||
while(low < high) { | ||
int val; | ||
|
||
mid = low + (high-low)/2; | ||
val = shmem_int_g(&keys[mid%N_PER_PE], mid/N_PER_PE); | ||
|
||
if(val == key) { | ||
return mid; | ||
} else if(val < key) { | ||
low = mid; | ||
} else { | ||
high = mid; | ||
} | ||
} | ||
|
||
return -1; | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
int i, errors = 0; | ||
|
||
shmem_init(); | ||
|
||
for (i = 0; i < N_PER_PE; i++) | ||
keys[i] = N_PER_PE * shmem_my_pe() + i; | ||
|
||
shmem_barrier_all(); | ||
|
||
for (i = 0; i < N_PER_PE * shmem_n_pes(); i++) { | ||
int j = binary_search(i); | ||
if (j != i) { | ||
printf("%2d: Error searching for %d. Found at index %d, expected %d\n", | ||
shmem_my_pe(), i, j, i); | ||
errors++; | ||
} | ||
} | ||
|
||
shmem_finalize(); | ||
|
||
return errors; | ||
} |
Oops, something went wrong.