├── AUTHORS ├── LICENSE ├── README.md ├── VERSIONS ├── bayes ├── Defines.common.mk ├── Makefile.seq ├── Makefile.stm ├── Makefile.stm.otm ├── README ├── adtree.c ├── adtree.h ├── bayes.c ├── data.c ├── data.h ├── learner.c ├── learner.h ├── net.c ├── net.h ├── operation.h ├── query.h ├── sort.c └── sort.h ├── common ├── Defines.common.mk ├── Defines.common.otm.mk ├── Makefile.common ├── Makefile.seq ├── Makefile.stm └── Makefile.stm.otm ├── genome ├── Defines.common.mk ├── Makefile.seq ├── Makefile.stm ├── Makefile.stm.otm ├── README ├── gene.c ├── gene.h ├── genome.c ├── nucleotide.h ├── segments.c ├── segments.h ├── sequencer.c ├── sequencer.h ├── table.c └── table.h ├── intruder ├── Defines.common.mk ├── Makefile.seq ├── Makefile.stm ├── Makefile.stm.otm ├── README ├── decoder.c ├── decoder.h ├── detector.c ├── detector.h ├── dictionary.c ├── dictionary.h ├── error.h ├── intruder.c ├── packet.c ├── packet.h ├── preprocessor.c ├── preprocessor.h ├── stream.c └── stream.h ├── kmeans ├── Defines.common.mk ├── LICENSE.kmeans ├── Makefile.seq ├── Makefile.stm ├── Makefile.stm.otm ├── README ├── cluster.c ├── cluster.h ├── common.c ├── common.h ├── inputs │ ├── color.gz │ ├── color100.gz │ ├── edge.gz │ ├── edge100.gz │ ├── generate.py.gz │ ├── random-n16384-d24-c16.txt.gz │ ├── random-n2048-d16-c16.txt.gz │ ├── random-n65536-d32-c16.txt.gz │ ├── random1000_12.gz │ ├── random50000_12.gz │ └── texture100.gz ├── kmeans.c ├── normal.c ├── normal.h └── util.h ├── labyrinth ├── Defines.common.mk ├── Makefile.seq ├── Makefile.stm ├── Makefile.stm.otm ├── README ├── coordinate.c ├── coordinate.h ├── grid.c ├── grid.h ├── inputs │ ├── generate.py │ ├── random-x128-y128-z3-n128.txt │ ├── random-x128-y128-z3-n64.txt │ ├── random-x128-y128-z5-n128.txt │ ├── random-x256-y256-z3-n256.txt │ ├── random-x256-y256-z5-n256.txt │ ├── random-x32-y32-z3-n64.txt │ ├── random-x32-y32-z3-n96.txt │ ├── random-x48-y48-z3-n48.txt │ ├── random-x48-y48-z3-n64.txt │ ├── random-x512-y512-z7-n512.txt │ ├── random-x64-y64-z3-n48.txt │ └── random-x64-y64-z3-n64.txt ├── labyrinth.c ├── maze.c ├── maze.h ├── router.c └── router.h ├── lib ├── LEGALNOTICE.rbtree ├── LICENSE.rbtree ├── Makefile ├── avltree.c ├── avltree.h ├── bitmap.c ├── bitmap.h ├── hash.c ├── hash.h ├── hashtable.c ├── hashtable.h ├── heap.c ├── heap.h ├── list.c ├── list.h ├── map.h ├── memory.c ├── memory.h ├── mt19937ar.c ├── mt19937ar.h ├── pair.c ├── pair.h ├── queue.c ├── queue.h ├── random.c ├── random.h ├── rbtree.c ├── rbtree.h ├── set.h ├── thread.c ├── thread.h ├── timer.h ├── tm.h ├── types.h ├── utility.h ├── vector.c └── vector.h ├── ssca2 ├── Defines.common.mk ├── Makefile.orig ├── Makefile.seq ├── Makefile.stm ├── Makefile.stm.otm ├── README ├── alg_radix_smp.c ├── alg_radix_smp.h ├── computeGraph.c ├── computeGraph.h ├── createPartition.c ├── createPartition.h ├── cutClusters.c ├── cutClusters.h ├── defs.h ├── findSubGraphs.c ├── findSubGraphs.h ├── genScalData.c ├── genScalData.h ├── getStartLists.c ├── getStartLists.h ├── getUserParameters.c ├── getUserParameters.h ├── globals.c ├── globals.h └── ssca2.c ├── vacation ├── Defines.common.mk ├── Makefile.seq ├── Makefile.stm ├── Makefile.stm.otm ├── README ├── action.h ├── client.c ├── client.h ├── customer.c ├── customer.h ├── manager.c ├── manager.h ├── operation.h ├── reservation.c ├── reservation.h └── vacation.c └── yada ├── Defines.common.mk ├── Makefile.seq ├── Makefile.stm ├── Makefile.stm.otm ├── README ├── coordinate.c ├── coordinate.h ├── element.c ├── element.h ├── inputs ├── 633.2.ele.gz ├── 633.2.node.gz ├── 633.2.poly.gz ├── dots.2.ele.gz ├── dots.2.node.gz ├── dots.2.poly.gz ├── ladder.2.ele.gz ├── ladder.2.node.gz ├── ladder.2.poly.gz ├── spiral.2.ele.gz ├── spiral.2.node.gz ├── spiral.2.poly.gz ├── ttimeu10000.2.ele.gz ├── ttimeu10000.2.node.gz ├── ttimeu10000.2.poly.gz ├── ttimeu100000.2.ele.gz ├── ttimeu100000.2.node.gz ├── ttimeu100000.2.poly.gz ├── ttimeu1000000.2.ele.gz ├── ttimeu1000000.2.node.gz └── ttimeu1000000.2.poly.gz ├── mesh.c ├── mesh.h ├── region.c ├── region.h └── yada.c /AUTHORS: -------------------------------------------------------------------------------- 1 | STAMP is maintained by: 2 | 3 | Chi Cao Minh (caominh@stanford.edu) 4 | 5 | The following people have contributed to STAMP: 6 | 7 | Stanford University TCC Group (http://tcc.stanford.edu) 8 | ----------------------------- 9 | Woongki Baek 10 | Nathan Grasso Bronson 11 | Chi Cao Minh 12 | Brian D. Carlstrom 13 | Jared Casper 14 | JaeWoong Chung 15 | Christos Kozyrakis 16 | Kunle Olukotun 17 | Martin Trautmann 18 | 19 | Others 20 | ------ 21 | bayes/sort: Michael Ringgaard 22 | kmeans: Wei-keng Liao, Brendan McCane 23 | lib/avltree: Julienne Walker 24 | lib/mt19937ar: Makoto Matsumoto, Takuji Nishimura 25 | lib/rbtree: Dave Dice, Ori Shalev, Nir Shavit 26 | ssca2: David A. Bader, Kamesh Madduri 27 | 28 | Bug Fixes 29 | --------- 30 | Aleksandar Dragojevic 31 | Pascal Felber 32 | Ruben Titos 33 | 34 | Compatibility Fixes 35 | ------------------- 36 | Sigmund Cherem 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | For the license of bayes/sort.h and bayes/sort.c, please see the header 2 | of the files. 3 | 4 | ------------------------------------------------------------------------ 5 | 6 | For the license of kmeans, please see kmeans/LICENSE.kmeans 7 | 8 | ------------------------------------------------------------------------ 9 | 10 | For the license of ssca2, please see ssca2/COPYRIGHT 11 | 12 | ------------------------------------------------------------------------ 13 | 14 | For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 15 | header of the files. 16 | 17 | ------------------------------------------------------------------------ 18 | 19 | For the license of lib/rbtree.h and lib/rbtree.c, please see 20 | lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 21 | 22 | ------------------------------------------------------------------------ 23 | 24 | Unless otherwise noted, the following license applies to STAMP files: 25 | 26 | Copyright (c) 2007, Stanford University 27 | All rights reserved. 28 | 29 | Redistribution and use in source and binary forms, with or without 30 | modification, are permitted provided that the following conditions are 31 | met: 32 | 33 | * Redistributions of source code must retain the above copyright 34 | notice, this list of conditions and the following disclaimer. 35 | 36 | * Redistributions in binary form must reproduce the above copyright 37 | notice, this list of conditions and the following disclaimer in 38 | the documentation and/or other materials provided with the 39 | distribution. 40 | 41 | * Neither the name of Stanford University nor the names of its 42 | contributors may be used to endorse or promote products derived 43 | from this software without specific prior written permission. 44 | 45 | THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 46 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 47 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 48 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 49 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 50 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 51 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 52 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 53 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 54 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 55 | THE POSSIBILITY OF SUCH DAMAGE. 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | stamp 2 | ===== 3 | 4 | ____ _____ _ __ __ ____ 5 | / ___| |_ _| / \ | \/ | | _ \ 6 | \___ \ | | / _ \ | |\/| | | |_) | 7 | ___) | | | / ___ \ | | | | | __/ 8 | |____/ |_| /_/ \_\ |_| |_| |_| 9 | 10 | Stanford Transactional Applications for Multi-Processing 11 | 12 | http://stamp.stanford.edu 13 | Announce List: stamp-announce@lists.stanford.edu 14 | General List: stamp-users@lists.stanford.edu 15 | Contact: stamp-users-owner@lists.stanford.edu 16 | 17 | 18 | ___Introduction___ 19 | 20 | The Stanford Transactional Applications for Multi-Processors (STAMP) is a 21 | collection of applications well suited for transactional memory research. For 22 | each application, STAMP includes sequential code, parallel code that uses 23 | coarse-grain transactions, and reference data sets. We provide transactional 24 | code for both HTM and STM systems, and provide an STM system based on TL2 [3]. A 25 | characterization of the applications is given in [1] and [2]. 26 | 27 | We are currently working on additional STAMP applications and welcome your 28 | feedback, corrections, and suggestions. If you make some improvements to STAMP, 29 | we would appreciate receiving a copy that we can include in the next release. 30 | 31 | If you use STAMP in your work, please cite [1]. Thanks for using STAMP! 32 | 33 | 34 | ___Distribution Contents___ 35 | 36 | This directory contains the following items: 37 | 38 | AUTHORS ----- A list of people who have contributed to STAMP 39 | LICENSE ----- BSD-style license; if you use STAMP, please let us know 40 | README ------ This file 41 | VERSIONS ---- Revision history 42 | bayes/ ------ Bayesian network structure learning benchmark 43 | common/ ----- Common Makefile variables and rules 44 | labyrinth/ -- Maze routing benchmark 45 | lib/ -------- Common libraries (data structures, etc.) 46 | genome/ ----- Gene sequencing benchmark 47 | intruder/ --- Network intrusion detectino benchmark 48 | kmeans/ ----- K-means clustering benchmark 49 | ssca2/ ------ Graph kernel benchmark 50 | vacation/ --- Travel reservation system benchmark 51 | yada/ ------- Delaunay mesh refinement benchmark 52 | 53 | Each of the benchmarks contains a README file that has a description of the 54 | program and inputs and instructions for compilation and running. There are 55 | different Makefiles to build different flavors (e.g., sequential, stm, etc.). 56 | 57 | To adapt the benchmarks for a particular TM system, change lib/tm*. These files 58 | contain documentation on the purpose and usage of each of the macros. 59 | 60 | For general compilation changes (e.g., choice of compiler), edit common/*. 61 | 62 | 63 | ___Platforms___ 64 | 65 | STAMP has been tested on Ubuntu 6, Ubuntu 7, Fedora Core 5, Fedora Core 6, 66 | CentOS 4, and CentOS 5, on both 32-bit i386 and 64-bit x86_64 architectures. 67 | 68 | 69 | ___References___ 70 | 71 | [1] C. Cao Minh, J. Chung, C. Kozyrakis, and K. Olukotun. STAMP: Stanford 72 | Transactional Applications for Multi-processing. In IISWC '08: Proceedings 73 | of The IEEE International Symposium on Workload Characterization, 74 | September 2008. 75 | 76 | [2] C. Cao Minh, M. Trautmann, J. Chung, A. McDonald, N. Bronson, J. Casper, 77 | C. Kozyrakis, and K. Olukotun. An Effective Hybrid Transactional Memory 78 | System with Strong Isolation Guarantees. In Proceedings of the 34th Annual 79 | International Symposium on Computer Architecture, 2007. 80 | 81 | [2] D. Dice, O. Shalev, and N. Shavit. Transactional Locking II. In 82 | Proceedings of the 20th International Symposium on Distributed Computing 83 | (DISC), 2006. 84 | -------------------------------------------------------------------------------- /VERSIONS: -------------------------------------------------------------------------------- 1 | 0.9.10 (8 Sept 2008) 2 | * Bug fixes: 3 | - bayes 4 | - Fixed score calculation for reverse operation 5 | - Workaround for crash during clean up phase on 64-bit 6 | - genome 7 | - Fixing type for global_i in normal.c 8 | - lib/bitmap 9 | - Fixing type identifiers for constants (64-bit compatibility) 10 | - lib/heap 11 | - Adding missed annotation for heap_remove 12 | 13 | 0.9.9 (18 June 2008) 14 | * Added three more benchmarks: 15 | - intruder: network intrusion detection 16 | - ssca2: graph kernels 17 | - yada: Delaunay mesh refinement 18 | * Updated READMEs with new arguments and references 19 | * bayes 20 | - Fixed missing use of transactional list iterator 21 | * genome 22 | - Use iterator functions to traverse linked lists 23 | * vacation 24 | - Removed unnecessary read barrier in customer.c 25 | * lib/rbtree 26 | - Support pointers to arbitrary keys and values instead of assuming 27 | longs 28 | 29 | 0.9.8 (30 May 2008) 30 | * Support for OpenTM (opentm.stanford.edu) 31 | 32 | 0.9.7 (20 Mar 2008) 33 | * bayes 34 | - Fixes to reduce variation in run time 35 | - New recommended arguments 36 | * labyrinth 37 | - Fixed bug where invalidated paths would not be discarded on abort 38 | - Option to use early release 39 | * vacation: 40 | - Added prepopulation of customer table 41 | - New recommended arguments 42 | * lib: 43 | - Adding annotation for early release to tm.h 44 | - list 45 | - Added missing barrier for list_free 46 | - queue 47 | - Fixed pointer annotations for queue 48 | - Fixed bug for queue_push 49 | - Added missing barrier for queue_free 50 | * Miscellaneous cast fixes and changes to support more compilers 51 | 52 | 0.9.6 (1 Dec 2007) 53 | * Added two new benchmarks: 54 | - bayes: learns structure of Bayesian network from observed data 55 | - labyrinth: routes mazes via Lee's algorithm 56 | * kmeans: 57 | - Added medium size input 58 | * lib: 59 | - STM memory allocation/deallocation macros moved from tm.h to stm.h 60 | - Added methods to bitmap and vector 61 | - Fixed annotation in list 62 | 63 | 0.9.5 (1 Oct 2007) 64 | * Support for 32/64-bit 65 | * Cleaned up annotations for transactional memory allocation 66 | - Use with TL2-x86 0.9.1 or greater 67 | * vacation 68 | - Moving randomization outside transactions 69 | * kmeans 70 | - new random inputs that are clusterable 71 | - add file input generation script 72 | * lib 73 | - simplified tm.h interface 74 | - threading-related code moved from tm.h to thread.{c,h} 75 | - added queue.{c,h} 76 | - small optimizations for hashtable.c 77 | * Several small miscellaneous changes 78 | 79 | 0.9.4 (26 June 2007) 80 | * Fix compilation issues 81 | * Bug fixes from Ruben Titos: 82 | - vacation: fixed ID initialization 83 | - lib/memory: fixed alignment 84 | 85 | 0.9.3 (19 June 2007) 86 | * Maintenance update (delaunay removed) 87 | 88 | 0.9.2 (25 May 2007) 89 | * Removed unnecessary transaction in kmeans 90 | * Revised non-simulator runtime options in READMEs 91 | 92 | 0.9.1 (21 May 2007) 93 | * Fixed unpaired TM_BEGINs 94 | 95 | 0.9.0 (11 May 2007) 96 | * Initial release 97 | -------------------------------------------------------------------------------- /bayes/Defines.common.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.mk 4 | # 5 | # ============================================================================== 6 | 7 | 8 | PROG := bayes 9 | 10 | SRCS += \ 11 | adtree.c \ 12 | bayes.c \ 13 | data.c \ 14 | learner.c \ 15 | net.c \ 16 | sort.c \ 17 | $(LIB)/bitmap.c \ 18 | $(LIB)/list.c \ 19 | $(LIB)/mt19937ar.c \ 20 | $(LIB)/queue.c \ 21 | $(LIB)/random.c \ 22 | $(LIB)/thread.c \ 23 | $(LIB)/vector.c \ 24 | # 25 | OBJS := ${SRCS:.c=.o} 26 | 27 | CFLAGS += -DLIST_NO_DUPLICATES 28 | CFLAGS += -DLEARNER_TRY_REMOVE 29 | CFLAGS += -DLEARNER_TRY_REVERSE 30 | 31 | 32 | # ============================================================================== 33 | # 34 | # End of Defines.common.mk 35 | # 36 | # ============================================================================== 37 | -------------------------------------------------------------------------------- /bayes/Makefile.seq: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.seq 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.seq 11 | 12 | 13 | .PHONY: test_data 14 | test_data: CFLAGS += -DTEST_DATA -O0 15 | test_data: LIB_SRCS := $(LIB)/{bitmap,list,queue,random,mt19937ar,vector}.c 16 | test_data: 17 | $(CC) $(CFLAGS) data.c sort.c net.c $(LIB_SRCS) -o $@ 18 | 19 | .PHONY: test_net 20 | test_net: CFLAGS += -DTEST_NET -O0 21 | test_net: LIB_SRCS := $(LIB)/{list,queue,bitmap,random,mt19937ar,vector}.c 22 | test_net: 23 | $(CC) $(CFLAGS) net.c $(LIB_SRCS) -o $@ 24 | 25 | .PHONY: test_adtree 26 | test_adtree: CFLAGS += -DTEST_ADTREE -O0 27 | test_adtree: LIB_SRCS := $(LIB)/{bitmap,queue,list,random,mt19937ar,vector}.c 28 | test_adtree: 29 | $(CC) $(CFLAGS) adtree.c data.c net.c sort.c $(LIB_SRCS) -o $@ 30 | 31 | .PHONY: test_learner 32 | test_learner: CFLAGS += -DTEST_LEARNER -O0 33 | test_learner: LIB_SRCS := $(LIB)/{bitmap,list,queue,random,mt19937ar,thread,vector}.c -lm 34 | test_learner: 35 | $(CC) $(CFLAGS) learner.c sort.c adtree.c data.c net.c $(LIB_SRCS) -o $@ 36 | 37 | 38 | # ============================================================================== 39 | # 40 | # Makefile.seq 41 | # 42 | # ============================================================================== 43 | 44 | -------------------------------------------------------------------------------- /bayes/Makefile.stm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /bayes/Makefile.stm.otm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm.otm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.otm.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm.otm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm.otm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /bayes/README: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | A Bayesian network (or a belief network) is a way of representing probability 5 | distributions for a set of variables in a concise and comprehensible graphical 6 | manner. Conceptually, a Bayesian network is represented as a directed acyclic 7 | graph, where each node represents a variable and each edge represents a 8 | conditional dependence. By recording the conditional independences among 9 | variables (the lack of an edge between two variables implies conditional 10 | independence), a Bayesian network is able to compactly represent all of the 11 | probability distributions. 12 | 13 | Bayesian networks have a variety of applications and are used for modeling 14 | knowledge in domains such as medicine, image processing, and decision support 15 | systems. For example, a Bayesian network can be used to calculate the 16 | probability of a patient having a specific disease, given the absence or 17 | presence of certain symptoms. 18 | 19 | This application implements an algorithm for learning Bayesian networks, which 20 | is an important part of machine learning. Typically, neither the probability 21 | distributions nor the conditional dependences among them are known or solvable 22 | for a human; thus Bayesian networks are often learned from observed data. 23 | The particular algorithm implements a hill-climbing strategy that uses both 24 | local and global search, similar to the technique described in [2]. For 25 | efficient probability distribution estimations, the adtree data structure 26 | from [3] is used. 27 | 28 | When using this benchmark, please cite [1]. 29 | 30 | 31 | Compiling and Running 32 | --------------------- 33 | 34 | To build the application, simply run: 35 | 36 | make -f 37 | 38 | in the source directory. For example, for the sequential flavor, run: 39 | 40 | make -f Makefile.seq 41 | 42 | By default, this produces an executable named "bayes", which can then be 43 | run in the following manner: 44 | 45 | ./bayes -e \ 46 | -i \ 47 | -n \ 48 | -p \ 49 | -q \ 50 | -r \ 51 | -s \ 52 | -t \ 53 | -v 54 | 55 | The data to learn from is randomly generated from a randomly generated Bayesian 56 | network with the following properties: 57 | 58 | 1) Consists of -v variables 59 | 2) Each variable has at most -n parents 60 | 3) The number of parents per variable will be, on average, -n * -p 61 | 62 | From this "master" Bayesian network, -r random records are generated and used 63 | as the input for the structure learning algorithm. 64 | 65 | The following arguments are recommended for simulated runs: 66 | 67 | -v32 -r1024 -n2 -p20 -s0 -i2 -e2 68 | 69 | For non-simulator runs, a larger Bayesian network can be learned: 70 | 71 | -v32 -r4096 -n10 -p40 -i2 -e8 -s1 72 | 73 | For multithreaded runs, the runing time can vary depending on the insertion 74 | order of edges. 75 | 76 | 77 | References 78 | ---------- 79 | 80 | [1] C. Cao Minh, J. Chung, C. Kozyrakis, and K. Olukotun. STAMP: Stanford 81 | Transactional Applications for Multi-processing. In IISWC '08: Proceedings 82 | of The IEEE International Symposium on Workload Characterization, 83 | September 2008. 84 | 85 | [2] D. M. Chickering, D. Heckerman, and C. Meek. A Bayesian approach to learning 86 | Bayesian networks with local structure. In Proceedings of Thirteenth 87 | Conference on Uncertainty in Artificial Intelligence, 1997. 88 | 89 | [3] A. Moore and M.-S. Lee. Cached sufficient statistics for efficient machine 90 | learning with large datasets. Journal of Artificial Intelligence Research 8, 91 | 1998. 92 | -------------------------------------------------------------------------------- /bayes/operation.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * operation.h 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #ifndef OPERATION_H 73 | #define OPERATION_H 1 74 | 75 | /* 76 | * All operations are performed from:other to:this 77 | */ 78 | 79 | typedef enum operation { 80 | OPERATION_INSERT = 0, 81 | OPERATION_REMOVE = 1, 82 | OPERATION_REVERSE = 2, 83 | NUM_OPERATION 84 | } operation_t; 85 | 86 | 87 | #endif /* OPERATION_H */ 88 | 89 | 90 | /* ============================================================================= 91 | * 92 | * End of operation.h 93 | * 94 | * ============================================================================= 95 | */ 96 | -------------------------------------------------------------------------------- /bayes/query.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * query.h 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #ifndef QUERY_H 73 | #define QUERY_H 1 74 | 75 | 76 | #define QUERY_VALUE_WILDCARD (-1L) 77 | 78 | typedef struct query { 79 | long index; 80 | long value; 81 | } query_t; 82 | 83 | 84 | #endif /* QUERY_H */ 85 | 86 | 87 | /* ============================================================================= 88 | * 89 | * End of query.h 90 | * 91 | * ============================================================================= 92 | */ 93 | -------------------------------------------------------------------------------- /common/Defines.common.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.mk 4 | # 5 | # ============================================================================== 6 | 7 | 8 | CC := gcc 9 | CFLAGS += -g -Wall -pthread 10 | CFLAGS += -O3 11 | CFLAGS += -I$(LIB) 12 | CPP := g++ 13 | CPPFLAGS += $(CFLAGS) 14 | LD := g++ 15 | LIBS += -lpthread 16 | 17 | # Remove these files when doing clean 18 | OUTPUT += 19 | 20 | LIB := ../lib 21 | 22 | STM := ../../tl2 23 | 24 | LOSTM := ../../OpenTM/lostm 25 | 26 | 27 | # ============================================================================== 28 | # 29 | # End of Defines.common.mk 30 | # 31 | # ============================================================================== 32 | -------------------------------------------------------------------------------- /common/Defines.common.otm.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.otm.mk 4 | # 5 | # ============================================================================== 6 | 7 | OTM_DIR := /tcc/u/wkbaek/OpenTM 8 | OTM_COMPILER_DIR := $(OTM_DIR)/build_c_cyc/gcc 9 | LIBOTM_DIR := $(OTM_DIR)/gcc/libotm 10 | LINUX_BIN_DIR := /usr/local/x86_64-unknown-linux-gnu/bin 11 | 12 | CC := $(OTM_COMPILER_DIR)/xgcc -B$(OTM_COMPILER_DIR) -B$(LINUX_BIN_DIR) 13 | 14 | CFLAGS_OTM := -DOTM 15 | CFLAGS_OTM += -fopenmp 16 | CFLAGS_OTM += -I $(LIBOTM_DIR) 17 | 18 | CFLAGS += -g -Wall -pthread 19 | CFLAGS += -O3 20 | CFLAGS += -I$(LIB) 21 | CPP := g++ 22 | CPPFLAGS += $(CFLAGS) 23 | LD := g++ 24 | 25 | LIBOTM_STM := $(LIBOTM_DIR)/libotm_stm.a 26 | LIBOTM_STM_SIM := $(LIBOTM_DIR)/libotm_stm_sim.a 27 | LIBOTM_HTM_SIM := $(LIBOTM_DIR)/libotm_htm_sim.a 28 | 29 | LIBS += -lpthread 30 | LIBS += -lm 31 | 32 | # Remove these files when doing clean 33 | OUTPUT += 34 | 35 | LIB := ../lib 36 | 37 | STM := ../../tl2 38 | 39 | LOSTM := ../../OpenTM/lostm 40 | 41 | 42 | # ============================================================================== 43 | # 44 | # End of Defines.common.otm.mk 45 | # 46 | # ============================================================================== 47 | -------------------------------------------------------------------------------- /common/Makefile.common: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.common 4 | # 5 | # ============================================================================== 6 | 7 | 8 | %.o: %.c *.h 9 | $(CC) $(CFLAGS) -c $< -o $@ 10 | 11 | %.o: %.cpp *.h 12 | $(CPP) $(CPPFLAGS) -c $< -o $@ 13 | 14 | 15 | # ============================================================================== 16 | # 17 | # End of Makefile.common 18 | # 19 | # ============================================================================== 20 | -------------------------------------------------------------------------------- /common/Makefile.seq: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.seq 4 | # 5 | # ============================================================================== 6 | 7 | 8 | # ============================================================================== 9 | # Rules 10 | # ============================================================================== 11 | 12 | .PHONY: default 13 | default: $(PROG) 14 | 15 | .PHONY: clean 16 | clean: 17 | $(RM) $(OBJS) $(PROG) $(OUTPUT) 18 | 19 | $(PROG): $(OBJS) 20 | $(LD) $(LDFLAGS) $^ $(LIBS) -o $(PROG) 21 | 22 | include ../common/Makefile.common 23 | 24 | 25 | # ============================================================================== 26 | # 27 | # Makefile.seq 28 | # 29 | # ============================================================================== 30 | 31 | -------------------------------------------------------------------------------- /common/Makefile.stm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | # ============================================================================== 9 | # Variables 10 | # ============================================================================== 11 | 12 | CFLAGS += -DSTM -I$(STM) 13 | CPPFLAGS := $(CFLAGS) 14 | LDFLAGS += -L$(STM) 15 | LIBS += -ltl2 16 | 17 | 18 | # ============================================================================== 19 | # Rules 20 | # ============================================================================== 21 | 22 | .PHONY: default 23 | default: $(PROG) 24 | 25 | .PHONY: clean 26 | clean: 27 | $(RM) $(OBJS) $(PROG) $(OUTPUT) 28 | 29 | $(PROG): $(OBJS) 30 | $(LD) $(LDFLAGS) $^ $(LIBS) -o $(PROG) 31 | 32 | include ../common/Makefile.common 33 | 34 | 35 | # ============================================================================== 36 | # 37 | # End of Makefile.stm 38 | # 39 | # ============================================================================== 40 | -------------------------------------------------------------------------------- /common/Makefile.stm.otm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm.otm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | # ============================================================================== 9 | # Variables 10 | # ============================================================================== 11 | 12 | CFLAGS += -DSTM 13 | CFLAGS += -I$(STM) 14 | #CFLAGS += -fdump-tree-gimple 15 | #CFLAGS += -fdump-tree-ompexp 16 | #CFLAGS += -fdump-tree-final_cleanup 17 | #TODO: currently tm_function does not work with inlining 18 | CFLAGS += -fno-inline-functions 19 | CFLAGS += -D__x86 20 | CFLAGS += -m32 -D__LP32 21 | CPPFLAGS := $(CFLAGS) 22 | LDFLAGS += -L$(STM) -m32 23 | LIBS += -ltl2 24 | LIBS += $(LIBOTM_STM) 25 | 26 | 27 | # ============================================================================== 28 | # Rules 29 | # ============================================================================== 30 | 31 | .PHONY: default 32 | default: $(PROG) 33 | 34 | .PHONY: clean 35 | clean: 36 | $(RM) $(OBJS) $(PROG) $(OUTPUT) 37 | 38 | .PHONY: $(PROG) 39 | $(PROG): CFLAGS += $(CFLAGS_OTM) 40 | $(PROG): CFLAGS += -ftl2 41 | $(PROG): $(OBJS) 42 | $(LD) $(LDFLAGS) $^ $(LIBS) -o $(PROG) 43 | 44 | .PHONY: $(PROG)-ltm 45 | $(PROG)-ltm: $(OBJS) 46 | $(LD) $(LDFLAGS) $^ $(LIBS) -o $(PROG) 47 | 48 | include ../common/Makefile.common 49 | 50 | 51 | # ============================================================================== 52 | # 53 | # End of Makefile.stm.otm 54 | # 55 | # ============================================================================== 56 | -------------------------------------------------------------------------------- /genome/Defines.common.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.mk 4 | # 5 | # ============================================================================== 6 | 7 | 8 | CFLAGS += -DLIST_NO_DUPLICATES 9 | CFLAGS += -DCHUNK_STEP1=12 10 | 11 | PROG := genome 12 | 13 | SRCS += \ 14 | gene.c \ 15 | genome.c \ 16 | segments.c \ 17 | sequencer.c \ 18 | table.c \ 19 | $(LIB)/bitmap.c \ 20 | $(LIB)/hash.c \ 21 | $(LIB)/hashtable.c \ 22 | $(LIB)/pair.c \ 23 | $(LIB)/random.c \ 24 | $(LIB)/list.c \ 25 | $(LIB)/mt19937ar.c \ 26 | $(LIB)/thread.c \ 27 | $(LIB)/vector.c \ 28 | # 29 | OBJS := ${SRCS:.c=.o} 30 | 31 | 32 | # ============================================================================== 33 | # 34 | # End of Defines.common.mk 35 | # 36 | # ============================================================================== 37 | -------------------------------------------------------------------------------- /genome/Makefile.seq: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.seq 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.seq 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # Makefile.seq 16 | # 17 | # ============================================================================== 18 | 19 | -------------------------------------------------------------------------------- /genome/Makefile.stm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /genome/Makefile.stm.otm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm.otm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.otm.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm.otm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm.otm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /genome/README: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | This benchmark implements a gene sequencing program that reconstructs the gene 5 | sequence from segments of a larger gene. 6 | 7 | For example, given the segments TCGG, GCAG, ATCG, CAGC, and GATC, the program 8 | will try to construct the shortest gene that can be made from them. 9 | 10 | For example, if we slide around the above segments we can get: 11 | 12 | TCGG 13 | GCAG 14 | ATCG 15 | CAGC 16 | GATC 17 | ============= 18 | CAGCAGATCGG 19 | 20 | 21 | This gives a final sequence of length 11. Another possible solution is: 22 | 23 | TCGG 24 | GCAG 25 | ATCG 26 | CAGC 27 | GATC 28 | ============= 29 | GATCGGCAGC 30 | 31 | This solution has length 10. Both are consistent with the segments provided, 32 | but the second is the optimal solution since it is shorter. 33 | 34 | The algorithm used to sequence the gene has three phases: 35 | 36 | 1) Remove duplicate segments by using hash-set 37 | 2) Match segments using Rabin-Karp string search algorithm [3] 38 | - Cycles are prevented by tracking starts/ends of matched chains 39 | 3) Build sequence 40 | 41 | The first two steps make up the bulk of the execution time and are parallelized. 42 | 43 | 44 | Compiling and Running 45 | --------------------- 46 | 47 | To build the application, simply run: 48 | 49 | make -f 50 | 51 | in the source directory. For example, for the sequential flavor, run: 52 | 53 | make -f Makefile.seq 54 | 55 | By default, this produces an executable named "genome", which can then be 56 | run in the following manner: 57 | 58 | ./genome -g \ 59 | -s \ 60 | -n \ 61 | -t 62 | 63 | To produce the data in [1] and [2], the following values were used: 64 | 65 | -g256 -s16 -n16384 66 | 67 | For running without a simulator, use the default values: 68 | 69 | -g16384 -s64 -n16777216 70 | 71 | 72 | Workload Size 73 | ------------- 74 | 75 | The size of the workload is determined by the -g, -s, and -n options. The 76 | gene sequencing example in "Introduction", would correspond to -g10 -s4 -n5. 77 | In general, the values for these three options should follow the following 78 | relationship: -s << -g << -n. Larger values increase the size of the workload. 79 | 80 | 81 | References 82 | ---------- 83 | 84 | [1] C. Cao Minh, J. Chung, C. Kozyrakis, and K. Olukotun. STAMP: Stanford 85 | Transactional Applications for Multi-processing. In IISWC '08: Proceedings 86 | of The IEEE International Symposium on Workload Characterization, 87 | September 2008. 88 | 89 | [2] C. Cao Minh, M. Trautmann, J. Chung, A. McDonald, N. Bronson, J. Casper, 90 | C. Kozyrakis, and K. Olukotun. An Effective Hybrid Transactional Memory 91 | System with Strong Isolation Guarantees. In Proceedings of the 34th Annual 92 | International Symposium on Computer Architecture, 2007. 93 | 94 | [3] R. M. Karp and M. O. Rabin. Efficient randomized pattern-matching 95 | algorithms. IBM Journal of Research and Development, 1987. 96 | -------------------------------------------------------------------------------- /genome/gene.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * gene.h 4 | * -- Create random gene 5 | * 6 | * ============================================================================= 7 | * 8 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 9 | * Author: Chi Cao Minh 10 | * 11 | * ============================================================================= 12 | * 13 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 14 | * of the files. 15 | * 16 | * ------------------------------------------------------------------------ 17 | * 18 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 19 | * 20 | * ------------------------------------------------------------------------ 21 | * 22 | * For the license of ssca2, please see ssca2/COPYRIGHT 23 | * 24 | * ------------------------------------------------------------------------ 25 | * 26 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 27 | * header of the files. 28 | * 29 | * ------------------------------------------------------------------------ 30 | * 31 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 32 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 33 | * 34 | * ------------------------------------------------------------------------ 35 | * 36 | * Unless otherwise noted, the following license applies to STAMP files: 37 | * 38 | * Copyright (c) 2007, Stanford University 39 | * All rights reserved. 40 | * 41 | * Redistribution and use in source and binary forms, with or without 42 | * modification, are permitted provided that the following conditions are 43 | * met: 44 | * 45 | * * Redistributions of source code must retain the above copyright 46 | * notice, this list of conditions and the following disclaimer. 47 | * 48 | * * Redistributions in binary form must reproduce the above copyright 49 | * notice, this list of conditions and the following disclaimer in 50 | * the documentation and/or other materials provided with the 51 | * distribution. 52 | * 53 | * * Neither the name of Stanford University nor the names of its 54 | * contributors may be used to endorse or promote products derived 55 | * from this software without specific prior written permission. 56 | * 57 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 58 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 60 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 61 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 62 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 63 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 64 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 65 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 66 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 67 | * THE POSSIBILITY OF SUCH DAMAGE. 68 | * 69 | * ============================================================================= 70 | */ 71 | 72 | 73 | #ifndef GENE_H 74 | #define GENE_H 1 75 | 76 | 77 | #include "bitmap.h" 78 | #include "random.h" 79 | 80 | 81 | typedef struct gene { 82 | long length; 83 | char* contents; 84 | bitmap_t* startBitmapPtr; /* used for creating segments */ 85 | } gene_t; 86 | 87 | 88 | /* ============================================================================= 89 | * gene_alloc 90 | * -- Does all memory allocation necessary for gene creation 91 | * -- Returns NULL on failure 92 | * ============================================================================= 93 | */ 94 | gene_t* 95 | gene_alloc (long length); 96 | 97 | 98 | /* ============================================================================= 99 | * gene_create 100 | * -- Populate contents with random gene 101 | * ============================================================================= 102 | */ 103 | void 104 | gene_create (gene_t* genePtr, random_t* randomPtr); 105 | 106 | 107 | /* ============================================================================= 108 | * gene_free 109 | * ============================================================================= 110 | */ 111 | void 112 | gene_free (gene_t* genePtr); 113 | 114 | 115 | #endif /* GENE_H */ 116 | 117 | 118 | /* ============================================================================= 119 | * 120 | * End of gene.h 121 | * 122 | * ============================================================================= 123 | */ 124 | -------------------------------------------------------------------------------- /genome/nucleotide.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * nucleotide.h 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #ifndef NUCLEOTIDE_H 73 | #define NUCLEOTIDE_H 1 74 | 75 | 76 | typedef enum nucleotide_type { 77 | NUCLEOTIDE_ADENINE = 'a', 78 | NUCLEOTIDE_CYTOSINE = 'c', 79 | NUCLEOTIDE_GUANINE = 'g', 80 | NUCLEOTIDE_THYMINE = 't', 81 | NUCLEOTIDE_NUM_TYPE = 4 82 | } nucleotide_type_t; 83 | 84 | 85 | #endif /* NUCLEOTIDE_H */ 86 | 87 | 88 | /* ============================================================================= 89 | * 90 | * End of nucleotide.h 91 | * 92 | * ============================================================================= 93 | */ 94 | -------------------------------------------------------------------------------- /intruder/Defines.common.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.mk 4 | # 5 | # ============================================================================== 6 | 7 | 8 | PROG := intruder 9 | 10 | SRCS += \ 11 | decoder.c \ 12 | detector.c \ 13 | dictionary.c \ 14 | intruder.c \ 15 | packet.c \ 16 | preprocessor.c \ 17 | stream.c \ 18 | $(LIB)/list.c \ 19 | $(LIB)/mt19937ar.c \ 20 | $(LIB)/pair.c \ 21 | $(LIB)/queue.c \ 22 | $(LIB)/random.c \ 23 | $(LIB)/rbtree.c \ 24 | $(LIB)/thread.c \ 25 | $(LIB)/vector.c \ 26 | # 27 | OBJS := ${SRCS:.c=.o} 28 | 29 | CFLAGS += -DMAP_USE_RBTREE 30 | 31 | 32 | # ============================================================================== 33 | # 34 | # End of Defines.common.mk 35 | # 36 | # ============================================================================== 37 | -------------------------------------------------------------------------------- /intruder/Makefile.seq: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.seq 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.seq 11 | 12 | .PHONY: test_decoder 13 | test_decoder: CFLAGS += -DTEST_DECODER -O0 14 | test_decoder: LIB_SRCS := $(LIB)/{list,mt19937ar,queue,random,rbtree}.c 15 | test_decoder: 16 | $(CC) $(CFLAGS) decoder.c packet.c $(LIB_SRCS) -o $@ 17 | 18 | .PHONY: test_detector 19 | test_detector: CFLAGS += -DTEST_DETECTOR -O0 20 | test_detector: LIB_SRCS := $(LIB)/vector.c 21 | test_detector: 22 | $(CC) $(CFLAGS) detector.c dictionary.c preprocessor.c $(LIB_SRCS) -o $@ 23 | 24 | .PHONY: test_dictionary 25 | test_dictionary: CFLAGS += -DTEST_DICTIONARY -O0 26 | test_dictionary: LIB_SRCS := $(LIB)/vector.c 27 | test_dictionary: 28 | $(CC) $(CFLAGS) dictionary.c $(LIB_SRCS) -o $@ 29 | 30 | .PHONY: test_preprocessor 31 | test_preprocessor: CFLAGS += -DTEST_PREPROCESSOR -O0 32 | test_preprocessor: 33 | $(CC) $(CFLAGS) preprocessor.c -o $@ 34 | 35 | .PHONY: test_stream 36 | test_stream: CFLAGS += -DTEST_STREAM -O0 37 | test_stream: LIB_SRCS := $(LIB)/{mt19937ar,pair,queue,random,rbtree,vector}.c 38 | test_stream: 39 | $(CC) $(CFLAGS) stream.c detector.c dictionary.c preprocessor.c $(LIB_SRCS) -o $@ 40 | 41 | 42 | # ============================================================================== 43 | # 44 | # Makefile.seq 45 | # 46 | # ============================================================================== 47 | 48 | -------------------------------------------------------------------------------- /intruder/Makefile.stm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /intruder/Makefile.stm.otm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm.otm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.otm.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm.otm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm.otm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /intruder/README: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | Signature-based network intrusion detection systems (NIDS) scan network packets 5 | for matches against a known set of intrusion signatures. This benchmark emulates 6 | Design~5 of the NIDS described by Haagdorens et al. in [2]. Network packets are 7 | processed in parallel and go through three phases: capture, reassembly, and 8 | detection. The main data structure in the capture phase is a simple FIFO queue, 9 | and the reassembly phase uses a dictionary (implemented by a self-balancing 10 | tree) that contains lists of packets that belong to the same session. When 11 | evaluating their five designs for a multithreaded NIDS, Haagdorens et al. state 12 | that the complexity of the reassembly phase caused them to use coarse-grain 13 | synchronization in Designs 4 and 5. Thus, even though these two designs 14 | attempted to exploit higher levels of concurrency, their coarse-grain 15 | synchronization resulted in worse performance. 16 | 17 | In the TM version included in STAMP, the capture and 18 | reassembly phases are each enclosed by transactions. Hence, the code 19 | for each phase is as simple as that with coarse-grain locks but hopefully 20 | achieves good performance through optimistic concurrency. When operating on 21 | these data structures, this benchmark has relatively short transactions. It also 22 | has moderate to high levels of contention depending on how often the 23 | reassembly phase rebalances its tree. Overall, since two of the three 24 | phases are spent in transactions, this benchmark has a moderate amount of total 25 | transactional execution time. 26 | 27 | When using this benchmark, please cite [1]. 28 | 29 | 30 | Compiling and Running 31 | --------------------- 32 | 33 | To build the application, simply run: 34 | 35 | make -f 36 | 37 | in the source directory. For example, for the sequential flavor, run: 38 | 39 | make -f Makefile.seq 40 | 41 | By default, this produces an executable named "intruder", which can then be 42 | run in the following manner: 43 | 44 | ./intruder -a \ 45 | -l \ 46 | -n \ 47 | -s \ 48 | -t 49 | 50 | On average, the total number of packets to analyze will be 0.5 * -l * -n. 51 | 52 | The following arguments are recommended for simulated runs: 53 | 54 | -a10 -l4 -n2038 -s1 55 | 56 | For non-simulator runs, a larger input can be used: 57 | 58 | -a10 -l128 -n262144 -s1 59 | 60 | 61 | References 62 | ---------- 63 | 64 | [1] C. Cao Minh, M. Trautmann, J. Chung, A. McDonald, N. Bronson, J. Casper, 65 | C. Kozyrakis, and K. Olukotun. An Effective Hybrid Transactional Memory 66 | System with Strong Isolation Guarantees. In Proceedings of the 34th Annual 67 | International Symposium on Computer Architecture, 2007. 68 | 69 | [2] B. Haagdorens, T. Vermeiren, and M. Goossens. Improving the performance of 70 | signature-based network intrusion detection sensors by multi-threading. In 71 | WISA '04: Proceedings of the 5th International Workshop on Infomation 72 | Security Applications, pages 188-203, 2004. 73 | -------------------------------------------------------------------------------- /intruder/error.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * error.h 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #ifndef ERROR_H 73 | #define ERROR_H 1 74 | 75 | 76 | typedef enum error { 77 | ERROR_NONE = 0, 78 | ERROR_SHORT = 1, 79 | ERROR_FLOWID = 2, 80 | ERROR_FRAGMENTID = 3, 81 | ERROR_LENGTH = 4, 82 | ERROR_NUMFRAGMENT = 5, 83 | ERROR_INCOMPLETE = 6, 84 | ERROR_SIGNATURE = 7, 85 | NUM_ERROR 86 | } error_t; 87 | 88 | 89 | #endif /* ERROR_H */ 90 | 91 | 92 | /* ============================================================================= 93 | * 94 | * End of error.h 95 | * 96 | * ============================================================================= 97 | */ 98 | -------------------------------------------------------------------------------- /intruder/packet.c: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * packet.c 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #include "packet.h" 73 | #include "types.h" 74 | 75 | 76 | /* ============================================================================= 77 | * packet_compareFlowId 78 | * ============================================================================= 79 | */ 80 | long 81 | packet_compareFlowId (const void* aPtr, const void* bPtr) 82 | { 83 | packet_t* aPacketPtr = (packet_t*)aPtr; 84 | packet_t* bPacketPtr = (packet_t*)bPtr; 85 | 86 | return (aPacketPtr->flowId - bPacketPtr->flowId); 87 | } 88 | 89 | 90 | /* ============================================================================= 91 | * packet_compareFragmentId 92 | * ============================================================================= 93 | */ 94 | long 95 | packet_compareFragmentId (const void* aPtr, const void* bPtr) 96 | { 97 | packet_t* aPacketPtr = (packet_t*)aPtr; 98 | packet_t* bPacketPtr = (packet_t*)bPtr; 99 | 100 | return (int)(aPacketPtr->fragmentId - bPacketPtr->fragmentId); 101 | } 102 | 103 | 104 | /* ============================================================================= 105 | * 106 | * End of packet.c 107 | * 108 | * ============================================================================= 109 | */ 110 | -------------------------------------------------------------------------------- /intruder/packet.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * packet.h 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #ifndef PACKET_H 73 | #define PACKET_H 1 74 | 75 | 76 | typedef struct packet { 77 | long flowId; 78 | long fragmentId; 79 | long numFragment; 80 | long length; 81 | char data[]; 82 | } packet_t; 83 | 84 | 85 | #define PACKET_HEADER_LENGTH (sizeof(packet_t)) /* no data */ 86 | 87 | 88 | /* ============================================================================= 89 | * packet_compareFlowId 90 | * ============================================================================= 91 | */ 92 | long 93 | packet_compareFlowId (const void* aPtr, const void* bPtr); 94 | 95 | 96 | /* ============================================================================= 97 | * packet_compareFragmentId 98 | * ============================================================================= 99 | */ 100 | long 101 | packet_compareFragmentId (const void* aPtr, const void* bPtr); 102 | 103 | 104 | #endif /* PACKET_H */ 105 | 106 | 107 | /* ============================================================================= 108 | * 109 | * End of packet.h 110 | * 111 | * ============================================================================= 112 | */ 113 | -------------------------------------------------------------------------------- /intruder/preprocessor.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * preprocessor.h 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #ifndef PREPROCESSOR_H 73 | #define PREPROCESSOR_H 1 74 | 75 | /* 76 | * All preprocessors should update in place 77 | */ 78 | typedef void (*preprocessor_t) (char*); 79 | 80 | 81 | /* ============================================================================= 82 | * preprocessor_convertURNHex 83 | * -- Translate % hex escape sequences 84 | * ============================================================================= 85 | */ 86 | void 87 | preprocessor_convertURNHex (char* str); 88 | 89 | 90 | /* ============================================================================= 91 | * preprocesser_toLower 92 | * -- Translate uppercase letters to lowercase 93 | * ============================================================================= 94 | */ 95 | void 96 | preprocessor_toLower (char* str); 97 | 98 | 99 | #endif /* PREPROCESSOR_H */ 100 | 101 | 102 | /* ============================================================================= 103 | * 104 | * End of preprocessor.h 105 | * 106 | * ============================================================================= 107 | */ 108 | -------------------------------------------------------------------------------- /kmeans/Defines.common.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.mk 4 | # 5 | # ============================================================================== 6 | 7 | 8 | CFLAGS += -DOUTPUT_TO_STDOUT 9 | 10 | PROG := kmeans 11 | 12 | SRCS += \ 13 | cluster.c \ 14 | common.c \ 15 | kmeans.c \ 16 | normal.c \ 17 | $(LIB)/mt19937ar.c \ 18 | $(LIB)/random.c \ 19 | $(LIB)/thread.c \ 20 | # 21 | OBJS := ${SRCS:.c=.o} 22 | 23 | 24 | # ============================================================================== 25 | # 26 | # End of Defines.common.mk 27 | # 28 | # ============================================================================== 29 | -------------------------------------------------------------------------------- /kmeans/LICENSE.kmeans: -------------------------------------------------------------------------------- 1 | IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 2 | By downloading, copying, installing or using the software you agree 3 | to this license. If you do not agree to this license, do not download, 4 | install, copy or use the software. 5 | 6 | 7 | Copyright (c) 2006 Northwestern University 8 | All rights reserved. 9 | 10 | Redistribution of the software in source and binary forms, 11 | with or without modification, is permitted provided that the 12 | following conditions are met: 13 | 14 | 1 Redistributions of source code must retain the above copyright 15 | notice, this list of conditions and the following disclaimer. 16 | 17 | 2 Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 21 | 3 Neither the name of Northwestern University nor the names of its 22 | contributors may be used to endorse or promote products derived 23 | from this software without specific prior written permission. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS 26 | IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT AND 28 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 29 | NORTHWESTERN UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 30 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | POSSIBILITY OF SUCH DAMAGE. 37 | -------------------------------------------------------------------------------- /kmeans/Makefile.seq: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.seq 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.seq 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # Makefile.seq 16 | # 17 | # ============================================================================== 18 | 19 | -------------------------------------------------------------------------------- /kmeans/Makefile.stm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /kmeans/Makefile.stm.otm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm.otm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.otm.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm.otm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm.otm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /kmeans/README: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | This benchmark was taken from NU-MineBench 2.0. Their technical report [3] 5 | provides a description of the algorithm: 6 | 7 | K-means is a partition-based method [4] and is arguably the most 8 | commonly used clustering technique. K-means represents a cluster by the 9 | mean value of all objects contained in it. Given the user-provided 10 | parameter k, the initial k cluster centers are randomly selected from 11 | the database. Then, K-means assigns each object to its nearest cluster 12 | center based on the similarity function. For example, for spatial 13 | clustering, usually the Euclid distance is used to measure the closeness 14 | of two objects. Once the assignments are completed, new centers are 15 | found by finding the mean of all the objects in each cluster. This 16 | process is repeated until two consecutive iterations generate the same 17 | cluster assignment. The clusters produced by the K-means algorithm are 18 | sometimes called "hard" clusters, since any data object either is or is 19 | not a member of a particular cluster. 20 | 21 | 22 | Compiling and Running 23 | --------------------- 24 | 25 | To build the application, simply run: 26 | 27 | make -f 28 | 29 | in the source directory. For example, for the sequential flavor, run: 30 | 31 | make -f Makefile.seq 32 | 33 | By default, this produces an executable named "kmeans", which can then be 34 | run in the following manner: 35 | 36 | ./kmeans -m \ 37 | -n \ 38 | -t \ 39 | -i \ 40 | -p 41 | 42 | To produce the data in [1], the following values were used: 43 | 44 | low contention: -m40 -n40 -t0.05 -i inputs/random2048-d16-c16.txt 45 | high contention: -m15 -n15 -t0.05 -i inputs/random2048-d16-c16.txt 46 | 47 | For runs without a simulator, a larger input file, (more info below) can be used 48 | instead: 49 | 50 | low contention: -m40 -n40 -t0.00001 -i inputs/random-n65536-d32-c16.txt 51 | high contention: -m15 -n15 -t0.00001 -i inputs/random-n65536-d32-c16.txt 52 | 53 | 54 | Input Files 55 | ----------- 56 | 57 | A section of the real image database distributed by Corel Corporation is used 58 | for K-means. This database consists of 17695 scenery pictures. Each picture is 59 | represented by two features: color and edge. The color feature is a vector of 9 60 | floating points while the edge feature is a vector of size 18. Both K-means 61 | implementations use Euclid distance as the similarity function and execute it 62 | for the two features separately. Since the clustering quality of K-means 63 | methods highly depends on the input parameter k, both K-means were executed 64 | with ten different k values ranging from 4 to 13. 65 | 66 | Smaller versions of "color", "edge", and "texture" were made by taking the 67 | first 100 lines of each file. The smaller inputs are called "color100", 68 | "edge100", and "texture100". 69 | 70 | The randomX_Y files were created by generating random data sets with X points 71 | of Y dimensions each. Values were selected from a uniform distribution. 72 | 73 | More input sets can be generated by using "inputs/generate.py". The script picks 74 | a given number of uniformly distributed random centers and then selects random 75 | points around those centers using a gaussian distribution. There are two 76 | included input files from this script: small, random-r2048-d16-c16.txt; and 77 | large, random-r65536-d32-c16.txt. In the filename, "n" refers to the number of 78 | points, "d" the number of dimensions, and "c" the number of centers. 79 | 80 | 81 | References 82 | ---------- 83 | 84 | [1] C. Cao Minh, J. Chung, C. Kozyrakis, and K. Olukotun. STAMP: Stanford 85 | Transactional Applications for Multi-processing. In IISWC '08: Proceedings 86 | of The IEEE International Symposium on Workload Characterization, 87 | September 2008. 88 | 89 | [2] J. Pisharath. NU-MineBench 2.0. Technical Report CUCIS-2005-08-01, 2005. 90 | 91 | [3] J.C. Bezdek. Pattern Recognition with Fuzzy Objective Function Algorithms. 92 | Kluwer Academic Publishers, 1981 93 | 94 | -------------------------------------------------------------------------------- /kmeans/cluster.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * cluster.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #ifndef CLUSTER_H 68 | #define CLUSTER_H 1 69 | 70 | 71 | /* ============================================================================= 72 | * cluster_exec 73 | * ============================================================================= 74 | */ 75 | int 76 | cluster_exec ( 77 | int nthreads, /* in: number of threads*/ 78 | int numObjects, /* number of input objects */ 79 | int numAttributes, /* size of attribute of each object */ 80 | float** attributes, /* [numObjects][numAttributes] */ 81 | int use_zscore_transform, 82 | int min_nclusters, /* testing k range from min to max */ 83 | int max_nclusters, 84 | float threshold, /* in: */ 85 | int* best_nclusters, /* out: number between min and max */ 86 | float*** cluster_centres, /* out: [best_nclusters][numAttributes] */ 87 | int* cluster_assign /* out: [numObjects] */ 88 | ); 89 | 90 | 91 | #endif /* CLUSTER_H */ 92 | 93 | 94 | /* ============================================================================= 95 | * 96 | * End of cluster.h 97 | * 98 | * ============================================================================= 99 | */ 100 | -------------------------------------------------------------------------------- /kmeans/common.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * common.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #ifndef COMMON_H 68 | #define COMMON_H 1 69 | 70 | 71 | #ifndef FLT_MAX 72 | # define FLT_MAX 3.40282347e+38 73 | #endif 74 | 75 | 76 | /* ============================================================================= 77 | * common_euclidDist2 78 | * -- multi-dimensional spatial Euclid distance square 79 | * ============================================================================= 80 | */ 81 | float 82 | common_euclidDist2 (float* pt1, float* pt2, int numdims); 83 | 84 | 85 | /* ============================================================================= 86 | * common_findNearestPoint 87 | * ============================================================================= 88 | */ 89 | int 90 | common_findNearestPoint (float* pt, /* [nfeatures] */ 91 | int nfeatures, 92 | float** pts, /* [npts][nfeatures] */ 93 | int npts); 94 | 95 | 96 | #endif /* COMMON_H */ 97 | 98 | 99 | /* ============================================================================= 100 | * 101 | * End of common.h 102 | * 103 | * ============================================================================= 104 | */ 105 | -------------------------------------------------------------------------------- /kmeans/inputs/color.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/color.gz -------------------------------------------------------------------------------- /kmeans/inputs/color100.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/color100.gz -------------------------------------------------------------------------------- /kmeans/inputs/edge.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/edge.gz -------------------------------------------------------------------------------- /kmeans/inputs/edge100.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/edge100.gz -------------------------------------------------------------------------------- /kmeans/inputs/generate.py.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/generate.py.gz -------------------------------------------------------------------------------- /kmeans/inputs/random-n16384-d24-c16.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/random-n16384-d24-c16.txt.gz -------------------------------------------------------------------------------- /kmeans/inputs/random-n2048-d16-c16.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/random-n2048-d16-c16.txt.gz -------------------------------------------------------------------------------- /kmeans/inputs/random-n65536-d32-c16.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/random-n65536-d32-c16.txt.gz -------------------------------------------------------------------------------- /kmeans/inputs/random1000_12.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/random1000_12.gz -------------------------------------------------------------------------------- /kmeans/inputs/random50000_12.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/random50000_12.gz -------------------------------------------------------------------------------- /kmeans/inputs/texture100.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/kmeans/inputs/texture100.gz -------------------------------------------------------------------------------- /kmeans/normal.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * normal.h 4 | * -- Implementation of normal k-means clustering algorithm 5 | * 6 | * ============================================================================= 7 | * 8 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 9 | * of the files. 10 | * 11 | * ------------------------------------------------------------------------ 12 | * 13 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of ssca2, please see ssca2/COPYRIGHT 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 22 | * header of the files. 23 | * 24 | * ------------------------------------------------------------------------ 25 | * 26 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 27 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 28 | * 29 | * ------------------------------------------------------------------------ 30 | * 31 | * Unless otherwise noted, the following license applies to STAMP files: 32 | * 33 | * Copyright (c) 2007, Stanford University 34 | * All rights reserved. 35 | * 36 | * Redistribution and use in source and binary forms, with or without 37 | * modification, are permitted provided that the following conditions are 38 | * met: 39 | * 40 | * * Redistributions of source code must retain the above copyright 41 | * notice, this list of conditions and the following disclaimer. 42 | * 43 | * * Redistributions in binary form must reproduce the above copyright 44 | * notice, this list of conditions and the following disclaimer in 45 | * the documentation and/or other materials provided with the 46 | * distribution. 47 | * 48 | * * Neither the name of Stanford University nor the names of its 49 | * contributors may be used to endorse or promote products derived 50 | * from this software without specific prior written permission. 51 | * 52 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 53 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 54 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 55 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 57 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 58 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 59 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 60 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 61 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 62 | * THE POSSIBILITY OF SUCH DAMAGE. 63 | * 64 | * ============================================================================= 65 | */ 66 | 67 | 68 | #ifndef NORMAL_H 69 | #define NORMAL_H 1 70 | 71 | 72 | #include "random.h" 73 | 74 | 75 | extern double global_parallelTime; 76 | 77 | 78 | /* ============================================================================= 79 | * normal_exec 80 | * ============================================================================= 81 | */ 82 | float** 83 | normal_exec (int nthreads, 84 | float** feature, /* in: [npoints][nfeatures] */ 85 | int nfeatures, 86 | int npoints, 87 | int nclusters, 88 | float threshold, 89 | int* membership, 90 | random_t* randomPtr); /* out: [npoints] */ 91 | 92 | 93 | #endif /* NORMAL_H */ 94 | 95 | 96 | /* ============================================================================= 97 | * 98 | * End of normal.h 99 | * 100 | * ============================================================================= 101 | */ 102 | -------------------------------------------------------------------------------- /kmeans/util.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * util.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | #ifndef UTIL_H 67 | #define UTIL_H 1 68 | 69 | 70 | #define SQR(x) ((x)*(x)) 71 | 72 | 73 | #endif /* UTIL_H */ 74 | 75 | 76 | /* ============================================================================= 77 | * 78 | * End of util.h 79 | * 80 | * ============================================================================= 81 | */ 82 | -------------------------------------------------------------------------------- /labyrinth/Defines.common.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.mk 4 | # 5 | # ============================================================================== 6 | 7 | 8 | LIBS += -lm 9 | 10 | PROG := labyrinth 11 | 12 | SRCS += \ 13 | coordinate.c \ 14 | grid.c \ 15 | labyrinth.c \ 16 | maze.c \ 17 | router.c \ 18 | $(LIB)/list.c \ 19 | $(LIB)/mt19937ar.c \ 20 | $(LIB)/pair.c \ 21 | $(LIB)/queue.c \ 22 | $(LIB)/random.c \ 23 | $(LIB)/thread.c \ 24 | $(LIB)/vector.c \ 25 | # 26 | OBJS := ${SRCS:.c=.o} 27 | 28 | CFLAGS += -DUSE_EARLY_RELEASE 29 | 30 | 31 | # ============================================================================== 32 | # 33 | # End of Defines.common.mk 34 | # 35 | # ============================================================================== 36 | -------------------------------------------------------------------------------- /labyrinth/Makefile.seq: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.seq 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.seq 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # Makefile.seq 16 | # 17 | # ============================================================================== 18 | 19 | -------------------------------------------------------------------------------- /labyrinth/Makefile.stm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /labyrinth/Makefile.stm.otm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm.otm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.otm.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm.otm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm.otm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /labyrinth/README: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | Given a maze, this benchmark finds the shortest-distance paths between pairs of 5 | starting and ending points. The routing algorithm used is Lee's algorithm [2]. 6 | 7 | In this algorithm, the maze is represented as a grid, where each grid point can 8 | contain connections to adjacent, non-diagonal grid points. The algorithm 9 | searches for a shortest path between the start and end points of a connection by 10 | performing a breadth-first search and labeling each grid point with its distance 11 | from the start. This expansion phase will eventually reach the end point if a 12 | connection is possible. A second traceback phase then forms the connection by 13 | following any path with a decreasing distance. This algorithm is guaranteed to 14 | find the shortest path between a start and end point; however, when multiple 15 | paths are made, one path may block another. 16 | 17 | When creating the transactional version of this program, the techniques 18 | described in [3] were used. When using this benchmark, please cite [1]. 19 | 20 | 21 | Compiling and Running 22 | --------------------- 23 | 24 | To build the application, simply run: 25 | 26 | make -f 27 | 28 | in the source directory. For example, for the sequential flavor, run: 29 | 30 | make -f Makefile.seq 31 | 32 | By default, this produces an executable named "labyrinth", which can then be 33 | run in the following manner: 34 | 35 | ./labyrinth -i 36 | 37 | The following input file is recommended for simulated runs: 38 | 39 | ./labyrinth -i inputs/random-x32-y32-z3-n96.txt 40 | 41 | For non-simulator runs, a larger input can be used: 42 | 43 | ./labyrinth -i inputs/random-x512-y512-z7-n512.txt 44 | 45 | 46 | Input Files 47 | ----------- 48 | 49 | More input sets can be generated by using "inputs/generate.py". For example, 50 | 51 | inputs/generate.py 128 128 3 64 52 | 53 | Will create a 128x128x3 maze grid and select 64 uniformly random start/end 54 | point pairs. 55 | 56 | 57 | References 58 | ---------- 59 | 60 | [1] C. Cao Minh, J. Chung, C. Kozyrakis, and K. Olukotun. STAMP: Stanford 61 | Transactional Applications for Multi-processing. In IISWC '08: Proceedings 62 | of The IEEE International Symposium on Workload Characterization, 63 | September 2008. 64 | 65 | [2] C. Lee. An algorithm for path connections and its applications. IRE Trans. 66 | On Electronic Computers, 1961. 67 | 68 | [3] I. Watson, C. Kirkham, and M. Lujan. A Study of a Transactional Parallel 69 | Routing Algorithm. Proceedings of the 16th International Conference on 70 | Parallel Architectures and Compilation Techniques, 2007. 71 | 72 | -------------------------------------------------------------------------------- /labyrinth/inputs/generate.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | 3 | import random 4 | import sys 5 | 6 | if len(sys.argv) != 5: 7 | print "Usage: ./generate.py x y z n" 8 | sys.exit(1) 9 | 10 | x = int(sys.argv[1]) 11 | y = int(sys.argv[2]) 12 | z = int(sys.argv[3]) 13 | numPath = int(sys.argv[4]) 14 | 15 | random.seed(0) 16 | 17 | print "# Dimensions (x, y, z)" 18 | print "d %i %i %i" % (x, y, z) 19 | print "" 20 | print "# Paths: Sources (x, y, z) -> Destinations (x, y, z)" 21 | for i in range(numPath): 22 | src = (random.randint(0, x-1), random.randint(0, y-1), random.randint(0, z-1)) 23 | while 1: 24 | dst = (random.randint(0, x-1), random.randint(0, y-1), random.randint(0, z-1)) 25 | if dst != src: 26 | break; 27 | print "p %3i %3i %1i %3i %3i %1i" % (src[0], src[1], src[2], dst[0], dst[1], dst[2]) 28 | -------------------------------------------------------------------------------- /labyrinth/inputs/random-x128-y128-z3-n128.txt: -------------------------------------------------------------------------------- 1 | # Dimensions (x, y, z) 2 | d 128 128 3 3 | 4 | # Paths: Sources (x, y, z) -> Destinations (x, y, z) 5 | p 108 97 1 33 65 1 6 | p 100 38 1 74 116 1 7 | p 36 96 1 32 116 2 8 | p 103 115 0 93 115 2 9 | p 60 12 1 78 116 2 10 | p 61 110 0 103 70 0 11 | p 92 51 2 85 0 1 12 | p 111 31 0 111 24 1 13 | p 30 123 2 57 10 0 14 | p 65 119 0 70 90 1 15 | p 104 69 2 77 75 1 16 | p 76 49 1 37 24 0 17 | p 78 84 1 11 96 2 18 | p 118 107 2 118 69 1 19 | p 90 35 2 108 114 1 20 | p 121 74 1 84 127 2 21 | p 101 10 1 62 80 2 22 | p 31 93 0 28 101 0 23 | p 104 12 0 89 5 1 24 | p 116 68 2 3 81 1 25 | p 73 50 1 125 4 0 26 | p 123 23 0 26 102 2 27 | p 2 54 0 33 28 1 28 | p 44 23 1 5 12 2 29 | p 25 45 2 107 117 0 30 | p 86 123 0 86 108 1 31 | p 32 76 1 22 60 1 32 | p 72 65 0 45 107 0 33 | p 71 1 2 42 5 0 34 | p 30 122 1 36 45 2 35 | p 81 79 2 49 53 1 36 | p 0 24 1 30 81 1 37 | p 112 72 1 51 89 1 38 | p 84 5 1 33 20 1 39 | p 62 71 2 113 63 0 40 | p 59 103 2 103 24 2 41 | p 81 10 2 126 51 2 42 | p 40 27 2 0 105 1 43 | p 12 15 1 111 35 2 44 | p 12 109 1 10 35 1 45 | p 101 110 0 66 83 1 46 | p 111 35 0 5 87 1 47 | p 121 120 2 5 95 2 48 | p 83 91 2 81 47 1 49 | p 26 75 0 19 42 2 50 | p 91 43 1 5 20 2 51 | p 37 50 1 37 61 0 52 | p 6 22 1 9 51 0 53 | p 53 12 2 60 107 2 54 | p 43 61 2 54 38 2 55 | p 114 117 1 48 124 1 56 | p 8 10 2 7 1 1 57 | p 66 57 1 74 86 1 58 | p 47 126 0 99 55 1 59 | p 8 110 2 115 57 2 60 | p 15 50 0 5 121 0 61 | p 18 25 1 69 19 2 62 | p 125 18 1 87 112 1 63 | p 117 41 1 63 85 0 64 | p 78 28 1 123 115 2 65 | p 4 18 0 100 107 1 66 | p 91 103 0 10 111 0 67 | p 28 5 0 108 42 0 68 | p 19 83 2 64 115 1 69 | p 73 86 2 97 126 2 70 | p 115 26 1 76 105 1 71 | p 101 49 1 108 102 1 72 | p 0 23 1 32 8 2 73 | p 120 38 1 103 7 1 74 | p 16 36 2 7 4 1 75 | p 62 110 2 86 19 2 76 | p 52 78 1 6 60 0 77 | p 4 79 1 13 70 1 78 | p 49 99 1 112 78 1 79 | p 80 43 0 87 79 2 80 | p 16 116 2 117 111 2 81 | p 103 66 2 24 100 1 82 | p 96 58 2 9 5 2 83 | p 62 115 2 85 73 0 84 | p 11 104 2 99 89 1 85 | p 39 14 1 72 118 2 86 | p 53 12 2 93 3 1 87 | p 87 3 2 123 92 0 88 | p 9 45 0 44 1 2 89 | p 104 9 2 26 26 2 90 | p 120 15 0 47 3 1 91 | p 109 23 0 44 122 0 92 | p 123 46 1 37 119 2 93 | p 81 23 2 13 74 0 94 | p 114 121 2 40 31 2 95 | p 37 53 0 16 2 0 96 | p 9 53 1 94 18 1 97 | p 81 10 1 47 121 0 98 | p 52 53 2 41 26 0 99 | p 60 121 2 35 71 2 100 | p 101 57 1 98 55 0 101 | p 58 119 0 59 81 1 102 | p 26 0 2 79 0 0 103 | p 98 80 1 19 90 1 104 | p 86 97 0 97 35 2 105 | p 15 113 0 32 67 1 106 | p 50 13 0 36 96 2 107 | p 76 4 2 39 43 1 108 | p 31 117 0 53 37 1 109 | p 73 80 1 52 81 1 110 | p 99 100 0 47 80 0 111 | p 89 48 1 17 85 1 112 | p 60 53 1 88 40 1 113 | p 7 38 2 6 79 0 114 | p 60 113 0 67 8 2 115 | p 87 94 2 0 5 1 116 | p 127 111 2 93 29 2 117 | p 36 13 1 42 21 1 118 | p 114 55 1 90 67 0 119 | p 116 56 2 49 103 1 120 | p 28 25 2 75 6 1 121 | p 29 10 0 7 81 0 122 | p 78 78 2 65 36 2 123 | p 45 58 1 66 122 2 124 | p 119 119 1 62 90 0 125 | p 34 5 0 0 83 0 126 | p 100 87 2 50 117 1 127 | p 43 13 2 101 41 1 128 | p 41 3 0 47 26 1 129 | p 24 25 2 94 39 2 130 | p 32 44 2 5 119 0 131 | p 58 92 0 103 125 1 132 | p 15 10 0 97 52 2 133 | -------------------------------------------------------------------------------- /labyrinth/inputs/random-x128-y128-z3-n64.txt: -------------------------------------------------------------------------------- 1 | # Dimensions (x, y, z) 2 | d 128 128 3 3 | 4 | # Paths: Sources (x, y, z) -> Destinations (x, y, z) 5 | p 108 97 1 33 65 1 6 | p 100 38 1 74 116 1 7 | p 36 96 1 32 116 2 8 | p 103 115 0 93 115 2 9 | p 60 12 1 78 116 2 10 | p 61 110 0 103 70 0 11 | p 92 51 2 85 0 1 12 | p 111 31 0 111 24 1 13 | p 30 123 2 57 10 0 14 | p 65 119 0 70 90 1 15 | p 104 69 2 77 75 1 16 | p 76 49 1 37 24 0 17 | p 78 84 1 11 96 2 18 | p 118 107 2 118 69 1 19 | p 90 35 2 108 114 1 20 | p 121 74 1 84 127 2 21 | p 101 10 1 62 80 2 22 | p 31 93 0 28 101 0 23 | p 104 12 0 89 5 1 24 | p 116 68 2 3 81 1 25 | p 73 50 1 125 4 0 26 | p 123 23 0 26 102 2 27 | p 2 54 0 33 28 1 28 | p 44 23 1 5 12 2 29 | p 25 45 2 107 117 0 30 | p 86 123 0 86 108 1 31 | p 32 76 1 22 60 1 32 | p 72 65 0 45 107 0 33 | p 71 1 2 42 5 0 34 | p 30 122 1 36 45 2 35 | p 81 79 2 49 53 1 36 | p 0 24 1 30 81 1 37 | p 112 72 1 51 89 1 38 | p 84 5 1 33 20 1 39 | p 62 71 2 113 63 0 40 | p 59 103 2 103 24 2 41 | p 81 10 2 126 51 2 42 | p 40 27 2 0 105 1 43 | p 12 15 1 111 35 2 44 | p 12 109 1 10 35 1 45 | p 101 110 0 66 83 1 46 | p 111 35 0 5 87 1 47 | p 121 120 2 5 95 2 48 | p 83 91 2 81 47 1 49 | p 26 75 0 19 42 2 50 | p 91 43 1 5 20 2 51 | p 37 50 1 37 61 0 52 | p 6 22 1 9 51 0 53 | p 53 12 2 60 107 2 54 | p 43 61 2 54 38 2 55 | p 114 117 1 48 124 1 56 | p 8 10 2 7 1 1 57 | p 66 57 1 74 86 1 58 | p 47 126 0 99 55 1 59 | p 8 110 2 115 57 2 60 | p 15 50 0 5 121 0 61 | p 18 25 1 69 19 2 62 | p 125 18 1 87 112 1 63 | p 117 41 1 63 85 0 64 | p 78 28 1 123 115 2 65 | p 4 18 0 100 107 1 66 | p 91 103 0 10 111 0 67 | p 28 5 0 108 42 0 68 | p 19 83 2 64 115 1 69 | -------------------------------------------------------------------------------- /labyrinth/inputs/random-x128-y128-z5-n128.txt: -------------------------------------------------------------------------------- 1 | # Dimensions (x, y, z) 2 | d 128 128 5 3 | 4 | # Paths: Sources (x, y, z) -> Destinations (x, y, z) 5 | p 108 97 2 33 65 2 6 | p 100 38 2 74 116 2 7 | p 36 96 3 32 116 4 8 | p 103 115 1 93 115 3 9 | p 60 12 2 78 116 4 10 | p 61 110 1 103 70 0 11 | p 92 51 4 85 0 2 12 | p 111 31 1 111 24 2 13 | p 30 123 4 57 10 1 14 | p 65 119 0 70 90 2 15 | p 104 69 4 77 75 2 16 | p 76 49 2 37 24 0 17 | p 78 84 2 11 96 4 18 | p 118 107 4 118 69 1 19 | p 90 35 4 108 114 2 20 | p 121 74 2 84 127 4 21 | p 101 10 3 62 80 4 22 | p 31 93 0 28 101 1 23 | p 104 12 0 89 5 2 24 | p 116 68 3 3 81 3 25 | p 73 50 1 125 4 0 26 | p 123 23 0 26 102 4 27 | p 2 54 0 33 28 3 28 | p 44 23 2 5 12 4 29 | p 25 45 3 107 117 0 30 | p 86 123 0 86 108 1 31 | p 32 76 2 22 60 2 32 | p 72 65 1 45 107 1 33 | p 71 1 3 42 5 1 34 | p 30 122 1 36 45 4 35 | p 81 79 3 49 53 3 36 | p 0 24 1 30 81 1 37 | p 112 72 2 51 89 2 38 | p 84 5 2 33 20 2 39 | p 62 71 3 113 63 1 40 | p 59 103 4 103 24 4 41 | p 81 10 3 126 51 3 42 | p 40 27 3 0 105 2 43 | p 12 15 3 111 35 4 44 | p 12 109 1 10 35 2 45 | p 101 110 0 66 83 1 46 | p 111 35 0 5 87 2 47 | p 121 120 4 5 95 3 48 | p 83 91 4 81 47 2 49 | p 26 75 0 19 42 3 50 | p 91 43 3 5 20 4 51 | p 37 50 2 37 61 1 52 | p 6 22 2 9 51 1 53 | p 53 12 4 60 107 4 54 | p 43 61 3 54 38 3 55 | p 114 117 3 48 124 3 56 | p 8 10 3 7 1 1 57 | p 66 57 2 74 86 2 58 | p 47 126 1 99 55 1 59 | p 8 110 3 115 57 3 60 | p 15 50 1 5 121 1 61 | p 18 25 1 69 19 4 62 | p 125 18 2 87 112 2 63 | p 117 41 2 63 85 1 64 | p 78 28 1 123 115 4 65 | p 4 18 1 100 107 2 66 | p 91 103 0 10 111 0 67 | p 28 5 0 108 42 0 68 | p 19 83 4 64 115 2 69 | p 73 86 4 97 126 3 70 | p 115 26 2 76 105 2 71 | p 101 49 2 108 102 3 72 | p 0 23 2 32 8 4 73 | p 120 38 2 103 7 3 74 | p 16 36 4 7 4 2 75 | p 62 110 3 86 19 4 76 | p 52 78 1 6 60 0 77 | p 4 79 3 13 70 1 78 | p 49 99 2 112 78 2 79 | p 80 43 0 87 79 3 80 | p 16 116 3 117 111 3 81 | p 103 66 3 24 100 2 82 | p 96 58 3 9 5 4 83 | p 62 115 4 85 73 1 84 | p 11 104 4 99 89 2 85 | p 39 14 2 72 118 4 86 | p 53 12 3 93 3 2 87 | p 87 3 4 123 92 0 88 | p 9 45 0 44 1 4 89 | p 104 9 4 26 26 3 90 | p 120 15 0 47 3 3 91 | p 109 23 0 44 122 0 92 | p 123 46 2 37 119 4 93 | p 81 23 4 13 74 0 94 | p 114 121 4 40 31 3 95 | p 37 53 0 16 2 0 96 | p 9 53 2 94 18 2 97 | p 81 10 2 47 121 0 98 | p 52 53 3 41 26 1 99 | p 60 121 3 35 71 3 100 | p 101 57 1 98 55 1 101 | p 58 119 0 59 81 2 102 | p 26 0 3 79 0 1 103 | p 98 80 2 19 90 2 104 | p 86 97 1 97 35 4 105 | p 15 113 0 32 67 2 106 | p 50 13 1 36 96 4 107 | p 76 4 3 39 43 2 108 | p 31 117 0 53 37 2 109 | p 73 80 2 52 81 2 110 | p 99 100 1 47 80 0 111 | p 89 48 2 17 85 1 112 | p 60 53 2 88 40 3 113 | p 7 38 3 6 79 0 114 | p 60 113 0 67 8 4 115 | p 87 94 3 0 5 3 116 | p 127 111 3 93 29 3 117 | p 36 13 2 42 21 2 118 | p 114 55 2 90 67 0 119 | p 116 56 3 49 103 1 120 | p 28 25 4 75 6 1 121 | p 29 10 0 7 81 0 122 | p 78 78 3 65 36 4 123 | p 45 58 3 66 122 4 124 | p 119 119 2 62 90 1 125 | p 34 5 0 0 83 0 126 | p 100 87 4 50 117 2 127 | p 43 13 4 101 41 2 128 | p 41 3 0 47 26 2 129 | p 24 25 3 94 39 4 130 | p 32 44 3 5 119 0 131 | p 58 92 0 103 125 2 132 | p 15 10 0 97 52 4 133 | -------------------------------------------------------------------------------- /labyrinth/inputs/random-x32-y32-z3-n64.txt: -------------------------------------------------------------------------------- 1 | # Dimensions (x, y, z) 2 | d 32 32 3 3 | 4 | # Paths: Sources (x, y, z) -> Destinations (x, y, z) 5 | p 27 24 1 8 16 1 6 | p 25 9 1 18 29 1 7 | p 9 24 1 8 29 2 8 | p 25 28 0 23 28 2 9 | p 15 3 1 19 29 2 10 | p 15 27 0 25 17 0 11 | p 23 12 2 21 0 1 12 | p 27 7 0 27 6 1 13 | p 7 30 2 14 2 0 14 | p 16 29 0 17 22 1 15 | p 26 17 2 19 18 1 16 | p 19 12 1 9 6 0 17 | p 19 21 1 2 24 2 18 | p 29 26 2 29 17 1 19 | p 22 8 2 27 28 1 20 | p 30 18 1 21 31 2 21 | p 25 2 1 15 20 2 22 | p 7 23 0 7 25 0 23 | p 26 3 0 22 1 1 24 | p 29 17 2 0 20 1 25 | p 18 12 1 31 1 0 26 | p 30 5 0 6 25 2 27 | p 0 13 0 8 7 1 28 | p 11 5 1 1 3 2 29 | p 6 11 2 26 29 0 30 | p 21 30 0 21 27 1 31 | p 8 19 1 5 15 1 32 | p 18 16 0 11 26 0 33 | p 17 0 2 10 1 0 34 | p 7 30 1 9 11 2 35 | p 20 19 2 12 13 1 36 | p 0 6 1 7 20 1 37 | p 28 18 1 12 22 1 38 | p 21 1 1 8 5 1 39 | p 15 17 2 28 15 0 40 | p 14 25 2 25 6 2 41 | p 20 2 2 31 12 2 42 | p 10 6 2 0 26 1 43 | p 3 3 1 27 8 2 44 | p 3 27 1 2 8 1 45 | p 25 27 0 16 20 1 46 | p 27 8 0 1 21 1 47 | p 30 30 2 1 23 2 48 | p 20 22 2 20 11 1 49 | p 6 18 0 4 10 2 50 | p 22 10 1 1 5 2 51 | p 9 12 1 9 15 0 52 | p 1 5 1 2 12 0 53 | p 13 3 2 15 26 2 54 | p 10 15 2 13 9 2 55 | p 28 29 1 12 31 1 56 | p 2 2 2 1 0 1 57 | p 16 14 1 18 21 1 58 | p 11 31 0 24 13 1 59 | p 2 27 2 28 14 2 60 | p 3 12 0 1 30 0 61 | p 4 6 1 17 4 2 62 | p 31 4 1 21 28 1 63 | p 29 10 1 15 21 0 64 | p 19 7 1 30 28 2 65 | p 1 4 0 25 26 1 66 | p 22 25 0 2 27 0 67 | p 7 1 0 27 10 0 68 | p 4 20 2 16 28 1 69 | -------------------------------------------------------------------------------- /labyrinth/inputs/random-x32-y32-z3-n96.txt: -------------------------------------------------------------------------------- 1 | # Dimensions (x, y, z) 2 | d 32 32 3 3 | 4 | # Paths: Sources (x, y, z) -> Destinations (x, y, z) 5 | p 27 24 1 8 16 1 6 | p 25 9 1 18 29 1 7 | p 9 24 1 8 29 2 8 | p 25 28 0 23 28 2 9 | p 15 3 1 19 29 2 10 | p 15 27 0 25 17 0 11 | p 23 12 2 21 0 1 12 | p 27 7 0 27 6 1 13 | p 7 30 2 14 2 0 14 | p 16 29 0 17 22 1 15 | p 26 17 2 19 18 1 16 | p 19 12 1 9 6 0 17 | p 19 21 1 2 24 2 18 | p 29 26 2 29 17 1 19 | p 22 8 2 27 28 1 20 | p 30 18 1 21 31 2 21 | p 25 2 1 15 20 2 22 | p 7 23 0 7 25 0 23 | p 26 3 0 22 1 1 24 | p 29 17 2 0 20 1 25 | p 18 12 1 31 1 0 26 | p 30 5 0 6 25 2 27 | p 0 13 0 8 7 1 28 | p 11 5 1 1 3 2 29 | p 6 11 2 26 29 0 30 | p 21 30 0 21 27 1 31 | p 8 19 1 5 15 1 32 | p 18 16 0 11 26 0 33 | p 17 0 2 10 1 0 34 | p 7 30 1 9 11 2 35 | p 20 19 2 12 13 1 36 | p 0 6 1 7 20 1 37 | p 28 18 1 12 22 1 38 | p 21 1 1 8 5 1 39 | p 15 17 2 28 15 0 40 | p 14 25 2 25 6 2 41 | p 20 2 2 31 12 2 42 | p 10 6 2 0 26 1 43 | p 3 3 1 27 8 2 44 | p 3 27 1 2 8 1 45 | p 25 27 0 16 20 1 46 | p 27 8 0 1 21 1 47 | p 30 30 2 1 23 2 48 | p 20 22 2 20 11 1 49 | p 6 18 0 4 10 2 50 | p 22 10 1 1 5 2 51 | p 9 12 1 9 15 0 52 | p 1 5 1 2 12 0 53 | p 13 3 2 15 26 2 54 | p 10 15 2 13 9 2 55 | p 28 29 1 12 31 1 56 | p 2 2 2 1 0 1 57 | p 16 14 1 18 21 1 58 | p 11 31 0 24 13 1 59 | p 2 27 2 28 14 2 60 | p 3 12 0 1 30 0 61 | p 4 6 1 17 4 2 62 | p 31 4 1 21 28 1 63 | p 29 10 1 15 21 0 64 | p 19 7 1 30 28 2 65 | p 1 4 0 25 26 1 66 | p 22 25 0 2 27 0 67 | p 7 1 0 27 10 0 68 | p 4 20 2 16 28 1 69 | p 18 21 2 24 31 2 70 | p 28 6 1 19 26 1 71 | p 25 12 1 27 25 1 72 | p 0 5 1 8 2 2 73 | p 30 9 1 25 1 1 74 | p 4 9 2 1 1 1 75 | p 15 27 2 21 4 2 76 | p 13 19 1 1 15 0 77 | p 1 19 1 3 17 1 78 | p 12 24 1 28 19 1 79 | p 20 10 0 21 19 2 80 | p 4 29 2 29 27 2 81 | p 25 16 2 6 25 1 82 | p 24 14 2 2 1 2 83 | p 15 28 2 21 18 0 84 | p 2 26 2 24 22 1 85 | p 9 3 1 18 29 2 86 | p 13 3 2 23 0 1 87 | p 21 0 2 30 23 0 88 | p 2 11 0 11 0 2 89 | p 26 2 2 6 6 2 90 | p 30 3 0 11 0 1 91 | p 27 5 0 11 30 0 92 | p 30 11 1 9 29 2 93 | p 20 5 2 3 18 0 94 | p 28 30 2 10 7 2 95 | p 9 13 0 4 0 0 96 | p 2 13 1 23 4 1 97 | p 20 2 1 11 30 0 98 | p 13 13 2 10 6 0 99 | p 15 30 2 8 17 2 100 | p 25 14 1 24 13 0 101 | -------------------------------------------------------------------------------- /labyrinth/inputs/random-x48-y48-z3-n48.txt: -------------------------------------------------------------------------------- 1 | # Dimensions (x, y, z) 2 | d 48 48 3 3 | 4 | # Paths: Sources (x, y, z) -> Destinations (x, y, z) 5 | p 40 36 1 12 24 1 6 | p 37 14 1 28 43 1 7 | p 13 36 1 12 43 2 8 | p 38 43 0 35 43 2 9 | p 22 4 1 29 43 2 10 | p 22 41 0 38 26 0 11 | p 34 19 2 32 0 1 12 | p 41 11 0 41 9 1 13 | p 11 46 2 21 3 0 14 | p 24 44 0 26 33 1 15 | p 39 25 2 28 28 1 16 | p 28 18 1 13 9 0 17 | p 29 31 1 4 36 2 18 | p 44 40 2 44 25 1 19 | p 33 13 2 40 42 1 20 | p 45 27 1 31 47 2 21 | p 38 3 1 23 30 2 22 | p 11 35 0 10 38 0 23 | p 39 4 0 33 2 1 24 | p 43 25 2 1 30 1 25 | p 27 18 1 47 1 0 26 | p 46 8 0 10 38 2 27 | p 1 20 0 12 10 1 28 | p 16 8 1 1 4 2 29 | p 9 17 2 40 44 0 30 | p 32 46 0 32 40 1 31 | p 12 28 1 8 22 1 32 | p 27 24 0 17 40 0 33 | p 26 0 2 16 2 0 34 | p 11 45 1 13 17 2 35 | p 30 29 2 18 19 1 36 | p 0 9 1 11 30 1 37 | p 42 27 1 19 33 1 38 | p 31 2 1 12 7 1 39 | p 23 26 2 42 23 0 40 | p 22 38 2 38 9 2 41 | p 30 4 2 47 19 2 42 | p 15 10 2 0 39 1 43 | p 4 5 1 41 13 2 44 | p 4 40 1 3 13 1 45 | p 38 41 0 25 31 1 46 | p 41 13 0 1 32 1 47 | p 45 45 2 2 35 2 48 | p 31 34 2 30 17 1 49 | p 9 28 0 7 16 2 50 | p 34 16 1 1 7 2 51 | p 13 18 1 14 22 0 52 | p 2 8 1 3 19 0 53 | -------------------------------------------------------------------------------- /labyrinth/inputs/random-x48-y48-z3-n64.txt: -------------------------------------------------------------------------------- 1 | # Dimensions (x, y, z) 2 | d 48 48 3 3 | 4 | # Paths: Sources (x, y, z) -> Destinations (x, y, z) 5 | p 40 36 1 12 24 1 6 | p 37 14 1 28 43 1 7 | p 13 36 1 12 43 2 8 | p 38 43 0 35 43 2 9 | p 22 4 1 29 43 2 10 | p 22 41 0 38 26 0 11 | p 34 19 2 32 0 1 12 | p 41 11 0 41 9 1 13 | p 11 46 2 21 3 0 14 | p 24 44 0 26 33 1 15 | p 39 25 2 28 28 1 16 | p 28 18 1 13 9 0 17 | p 29 31 1 4 36 2 18 | p 44 40 2 44 25 1 19 | p 33 13 2 40 42 1 20 | p 45 27 1 31 47 2 21 | p 38 3 1 23 30 2 22 | p 11 35 0 10 38 0 23 | p 39 4 0 33 2 1 24 | p 43 25 2 1 30 1 25 | p 27 18 1 47 1 0 26 | p 46 8 0 10 38 2 27 | p 1 20 0 12 10 1 28 | p 16 8 1 1 4 2 29 | p 9 17 2 40 44 0 30 | p 32 46 0 32 40 1 31 | p 12 28 1 8 22 1 32 | p 27 24 0 17 40 0 33 | p 26 0 2 16 2 0 34 | p 11 45 1 13 17 2 35 | p 30 29 2 18 19 1 36 | p 0 9 1 11 30 1 37 | p 42 27 1 19 33 1 38 | p 31 2 1 12 7 1 39 | p 23 26 2 42 23 0 40 | p 22 38 2 38 9 2 41 | p 30 4 2 47 19 2 42 | p 15 10 2 0 39 1 43 | p 4 5 1 41 13 2 44 | p 4 40 1 3 13 1 45 | p 38 41 0 25 31 1 46 | p 41 13 0 1 32 1 47 | p 45 45 2 2 35 2 48 | p 31 34 2 30 17 1 49 | p 9 28 0 7 16 2 50 | p 34 16 1 1 7 2 51 | p 13 18 1 14 22 0 52 | p 2 8 1 3 19 0 53 | p 19 4 2 22 40 2 54 | p 16 22 2 20 14 2 55 | p 42 44 1 18 46 1 56 | p 3 4 2 2 0 1 57 | p 24 21 1 28 32 1 58 | p 17 47 0 37 20 1 59 | p 3 41 2 43 21 2 60 | p 5 19 0 2 45 0 61 | p 7 9 1 26 7 2 62 | p 47 7 1 32 42 1 63 | p 44 15 1 23 32 0 64 | p 29 10 1 46 43 2 65 | p 1 7 0 37 40 1 66 | p 34 38 0 4 41 0 67 | p 10 1 0 40 15 0 68 | p 7 31 2 24 43 1 69 | -------------------------------------------------------------------------------- /labyrinth/inputs/random-x64-y64-z3-n48.txt: -------------------------------------------------------------------------------- 1 | # Dimensions (x, y, z) 2 | d 64 64 3 3 | 4 | # Paths: Sources (x, y, z) -> Destinations (x, y, z) 5 | p 54 48 1 16 32 1 6 | p 50 19 1 37 58 1 7 | p 18 48 1 16 58 2 8 | p 51 57 0 46 57 2 9 | p 30 6 1 39 58 2 10 | p 30 55 0 51 35 0 11 | p 46 25 2 42 0 1 12 | p 55 15 0 55 12 1 13 | p 15 61 2 28 5 0 14 | p 32 59 0 35 45 1 15 | p 52 34 2 38 37 1 16 | p 38 24 1 18 12 0 17 | p 39 42 1 5 48 2 18 | p 59 53 2 59 34 1 19 | p 45 17 2 54 57 1 20 | p 60 37 1 42 63 2 21 | p 50 5 1 31 40 2 22 | p 15 46 0 14 50 0 23 | p 52 6 0 44 2 1 24 | p 58 34 2 1 40 1 25 | p 36 25 1 62 2 0 26 | p 61 11 0 13 51 2 27 | p 1 27 0 16 14 1 28 | p 22 11 1 2 6 2 29 | p 12 22 2 53 58 0 30 | p 43 61 0 43 54 1 31 | p 16 38 1 11 30 1 32 | p 36 32 0 22 53 0 33 | p 35 0 2 21 2 0 34 | p 15 61 1 18 22 2 35 | p 40 39 2 24 26 1 36 | p 0 12 1 15 40 1 37 | p 56 36 1 25 44 1 38 | p 42 2 1 16 10 1 39 | p 31 35 2 56 31 0 40 | p 29 51 2 51 12 2 41 | p 40 5 2 63 25 2 42 | p 20 13 2 0 52 1 43 | p 6 7 1 55 17 2 44 | p 6 54 1 5 17 1 45 | p 50 55 0 33 41 1 46 | p 55 17 0 2 43 1 47 | p 60 60 2 2 47 2 48 | p 41 45 2 40 23 1 49 | p 13 37 0 9 21 2 50 | p 45 21 1 2 10 2 51 | p 18 25 1 18 30 0 52 | p 3 11 1 4 25 0 53 | -------------------------------------------------------------------------------- /labyrinth/inputs/random-x64-y64-z3-n64.txt: -------------------------------------------------------------------------------- 1 | # Dimensions (x, y, z) 2 | d 64 64 3 3 | 4 | # Paths: Sources (x, y, z) -> Destinations (x, y, z) 5 | p 54 48 1 16 32 1 6 | p 50 19 1 37 58 1 7 | p 18 48 1 16 58 2 8 | p 51 57 0 46 57 2 9 | p 30 6 1 39 58 2 10 | p 30 55 0 51 35 0 11 | p 46 25 2 42 0 1 12 | p 55 15 0 55 12 1 13 | p 15 61 2 28 5 0 14 | p 32 59 0 35 45 1 15 | p 52 34 2 38 37 1 16 | p 38 24 1 18 12 0 17 | p 39 42 1 5 48 2 18 | p 59 53 2 59 34 1 19 | p 45 17 2 54 57 1 20 | p 60 37 1 42 63 2 21 | p 50 5 1 31 40 2 22 | p 15 46 0 14 50 0 23 | p 52 6 0 44 2 1 24 | p 58 34 2 1 40 1 25 | p 36 25 1 62 2 0 26 | p 61 11 0 13 51 2 27 | p 1 27 0 16 14 1 28 | p 22 11 1 2 6 2 29 | p 12 22 2 53 58 0 30 | p 43 61 0 43 54 1 31 | p 16 38 1 11 30 1 32 | p 36 32 0 22 53 0 33 | p 35 0 2 21 2 0 34 | p 15 61 1 18 22 2 35 | p 40 39 2 24 26 1 36 | p 0 12 1 15 40 1 37 | p 56 36 1 25 44 1 38 | p 42 2 1 16 10 1 39 | p 31 35 2 56 31 0 40 | p 29 51 2 51 12 2 41 | p 40 5 2 63 25 2 42 | p 20 13 2 0 52 1 43 | p 6 7 1 55 17 2 44 | p 6 54 1 5 17 1 45 | p 50 55 0 33 41 1 46 | p 55 17 0 2 43 1 47 | p 60 60 2 2 47 2 48 | p 41 45 2 40 23 1 49 | p 13 37 0 9 21 2 50 | p 45 21 1 2 10 2 51 | p 18 25 1 18 30 0 52 | p 3 11 1 4 25 0 53 | p 26 6 2 30 53 2 54 | p 21 30 2 27 19 2 55 | p 57 58 1 24 62 1 56 | p 4 5 2 3 0 1 57 | p 33 28 1 37 43 1 58 | p 23 63 0 49 27 1 59 | p 4 55 2 57 28 2 60 | p 7 25 0 2 60 0 61 | p 9 12 1 34 9 2 62 | p 62 9 1 43 56 1 63 | p 58 20 1 31 42 0 64 | p 39 14 1 61 57 2 65 | p 2 9 0 50 53 1 66 | p 45 51 0 5 55 0 67 | p 14 2 0 54 21 0 68 | p 9 41 2 32 57 1 69 | -------------------------------------------------------------------------------- /lib/LEGALNOTICE.rbtree: -------------------------------------------------------------------------------- 1 | This file only applies to the rbtree.c and rbtree.h files. 2 | 3 | ------------------------------------------------------------------------ 4 | 5 | Sun Microsystems, Inc. has intellectual property rights relating to 6 | technology embodied in the product that is described in this document. 7 | In particular, and without limitation, these intellectual property 8 | rights may include one or more of the U.S. patents listed at 9 | http://www.sun.com/patents and one or more additional patents or pendi 10 | ng patent applications in the U.S. and in other countries. Use is 11 | subject to license terms. Sun, Sun Microsystems, the Sun logo, Java 12 | and Solaris are trademarks or registered trademarks of Sun Microsystems, 13 | Inc. in the U.S. and other countries. UNIX is a registered trademark in 14 | the U.S. and other countries, exclusively licensed through X/Open 15 | Company, Ltd. 16 | -------------------------------------------------------------------------------- /lib/LICENSE.rbtree: -------------------------------------------------------------------------------- 1 | This file only applies to the rbtree.c and rbtree.h files. 2 | 3 | ------------------------------------------------------------------------ 4 | 5 | Copyright (c) 2006, Sun Microsystems, Inc. 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | * Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | * Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in 16 | the documentation and/or other materials provided with the 17 | distribution. 18 | * Neither the name of the Sun Microsystems, Inc. nor the names of 19 | its contributors may be used to endorse or promote products 20 | derived from this software without specific prior written 21 | permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | -------------------------------------------------------------------------------- /lib/Makefile: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile for lib 4 | # 5 | # ============================================================================== 6 | 7 | 8 | # ============================================================================== 9 | # Variables 10 | # ============================================================================== 11 | 12 | CC := gcc 13 | CFLAGS := -g -Wall 14 | 15 | SRCS := \ 16 | bitmap.c \ 17 | hash.c \ 18 | hashtable.c \ 19 | list.c \ 20 | memory.c \ 21 | mt19937ar.c \ 22 | pair.c \ 23 | queue.c \ 24 | random.c \ 25 | rbtree.c \ 26 | thread.c \ 27 | tm.c \ 28 | tmalloc.c \ 29 | vector.c \ 30 | # 31 | OBJS := ${SRCS:.c=.o} 32 | 33 | PROG_TEST := \ 34 | test_bitmap \ 35 | test_hashtable \ 36 | test_list \ 37 | test_memory \ 38 | test_pair \ 39 | test_queue \ 40 | test_random \ 41 | test_rbtree \ 42 | test_thread \ 43 | test_tmalloc \ 44 | test_vector \ 45 | # 46 | 47 | RM := rm -f 48 | 49 | 50 | # ============================================================================== 51 | # Unit tests 52 | # ============================================================================== 53 | 54 | .PHONY: clean 55 | clean: 56 | $(RM) $(OBJS) $(PROG_TEST) 57 | 58 | .PHONY: all 59 | all: $(PROG_TEST) 60 | 61 | .PHONY: test_bitmap 62 | test_bitmap: CFLAGS += -DTEST_BITMAP 63 | test_bitmap: 64 | $(CC) $(CFLAGS) bitmap.c -o $@ 65 | 66 | .PHONY: test_hashtable 67 | test_hashtable: CFLAGS += -DTEST_HASHTABLE 68 | test_hashtable: CFLAGS += -DHASHTABLE_RESIZABLE -DLIST_NO_DUPLICATES 69 | test_hashtable: 70 | $(CC) $(CFLAGS) hashtable.c list.c pair.c memory.c -o $@ 71 | 72 | .PHONY: test_list 73 | test_list: CFLAGS += -DTEST_LIST 74 | test_list: 75 | $(CC) $(CFLAGS) list.c memory.c -o $@ 76 | 77 | .PHONY: test_memory 78 | test_memory: CFLAGS += -DTEST_MEMORY 79 | test_memory: 80 | $(CC) $(CFLAGS) memory.c -o $@ 81 | 82 | .PHONY: test_pair 83 | test_pair: CFLAGS += -DTEST_PAIR 84 | test_pair: 85 | $(CC) $(CFLAGS) pair.c memory.c -o $@ 86 | 87 | .PHONY: test_queue 88 | test_queue: CFLAGS += -DTEST_QUEUE 89 | test_queue: 90 | $(CC) $(CFLAGS) queue.c random.c mt19937ar.c memory.c -o $@ 91 | 92 | .PHONY: test_random 93 | test_random: CFLAGS += -DTEST_RANDOM 94 | test_random: 95 | $(CC) $(CFLAGS) random.c -o $@ 96 | 97 | .PHONY: test_rbtree 98 | test_rbtree: CFLAGS += -DTEST_RBTREE 99 | test_rbtree: 100 | $(CC) $(CFLAGS) rbtree.c -o $@ 101 | 102 | .PHONY: test_thread 103 | test_thread: CFLAGS += -DTEST_THREAD 104 | test_thread: 105 | $(CC) $(CFLAGS) thread.c -lpthread -o $@ 106 | 107 | .PHONY: test_tmalloc 108 | test_tmalloc: CFLAGS += -DTEST_TMALLOC 109 | test_tmalloc: 110 | $(CC) $(CFLAGS) tmalloc.c -o $@ 111 | 112 | .PHONY: test_vector 113 | test_vector: CFLAGS += -DTEST_VECTOR 114 | test_vector: 115 | $(CC) $(CFLAGS) vector.c -o $@ 116 | 117 | 118 | 119 | # ============================================================================== 120 | # 121 | # End of Makefile for lib 122 | # 123 | # ============================================================================== 124 | -------------------------------------------------------------------------------- /lib/hash.c: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * hash.c 4 | * -- Collection of hash functions 5 | * 6 | * ============================================================================= 7 | * 8 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 9 | * Author: Chi Cao Minh 10 | * 11 | * ============================================================================= 12 | * 13 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 14 | * of the files. 15 | * 16 | * ------------------------------------------------------------------------ 17 | * 18 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 19 | * 20 | * ------------------------------------------------------------------------ 21 | * 22 | * For the license of ssca2, please see ssca2/COPYRIGHT 23 | * 24 | * ------------------------------------------------------------------------ 25 | * 26 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 27 | * header of the files. 28 | * 29 | * ------------------------------------------------------------------------ 30 | * 31 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 32 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 33 | * 34 | * ------------------------------------------------------------------------ 35 | * 36 | * Unless otherwise noted, the following license applies to STAMP files: 37 | * 38 | * Copyright (c) 2007, Stanford University 39 | * All rights reserved. 40 | * 41 | * Redistribution and use in source and binary forms, with or without 42 | * modification, are permitted provided that the following conditions are 43 | * met: 44 | * 45 | * * Redistributions of source code must retain the above copyright 46 | * notice, this list of conditions and the following disclaimer. 47 | * 48 | * * Redistributions in binary form must reproduce the above copyright 49 | * notice, this list of conditions and the following disclaimer in 50 | * the documentation and/or other materials provided with the 51 | * distribution. 52 | * 53 | * * Neither the name of Stanford University nor the names of its 54 | * contributors may be used to endorse or promote products derived 55 | * from this software without specific prior written permission. 56 | * 57 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 58 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 60 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 61 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 62 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 63 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 64 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 65 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 66 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 67 | * THE POSSIBILITY OF SUCH DAMAGE. 68 | * 69 | * ============================================================================= 70 | */ 71 | 72 | 73 | #include "hash.h" 74 | #include "types.h" 75 | 76 | 77 | /* ============================================================================= 78 | * hash_dbj2 79 | * ============================================================================= 80 | */ 81 | ulong_t 82 | hash_dbj2 (char* str) 83 | { 84 | ulong_t hash = 5381; 85 | ulong_t c; 86 | 87 | while ((c = *str++) != '\0') { 88 | hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ 89 | } 90 | 91 | return hash; 92 | } 93 | 94 | 95 | /* ============================================================================= 96 | * hash_sdbm 97 | * ============================================================================= 98 | */ 99 | ulong_t 100 | hash_sdbm (char* str) 101 | { 102 | ulong_t hash = 0; 103 | ulong_t c; 104 | 105 | while ((c = *str++) != '\0') { 106 | hash = c + (hash << 6) + (hash << 16) - hash; 107 | } 108 | 109 | return hash; 110 | } 111 | 112 | 113 | /* ============================================================================= 114 | * 115 | * End of hash.h 116 | * 117 | * ============================================================================= 118 | */ 119 | -------------------------------------------------------------------------------- /lib/hash.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * hash.h 4 | * -- Collection of hash functions 5 | * 6 | * ============================================================================= 7 | * 8 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 9 | * Author: Chi Cao Minh 10 | * 11 | * ============================================================================= 12 | * 13 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 14 | * of the files. 15 | * 16 | * ------------------------------------------------------------------------ 17 | * 18 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 19 | * 20 | * ------------------------------------------------------------------------ 21 | * 22 | * For the license of ssca2, please see ssca2/COPYRIGHT 23 | * 24 | * ------------------------------------------------------------------------ 25 | * 26 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 27 | * header of the files. 28 | * 29 | * ------------------------------------------------------------------------ 30 | * 31 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 32 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 33 | * 34 | * ------------------------------------------------------------------------ 35 | * 36 | * Unless otherwise noted, the following license applies to STAMP files: 37 | * 38 | * Copyright (c) 2007, Stanford University 39 | * All rights reserved. 40 | * 41 | * Redistribution and use in source and binary forms, with or without 42 | * modification, are permitted provided that the following conditions are 43 | * met: 44 | * 45 | * * Redistributions of source code must retain the above copyright 46 | * notice, this list of conditions and the following disclaimer. 47 | * 48 | * * Redistributions in binary form must reproduce the above copyright 49 | * notice, this list of conditions and the following disclaimer in 50 | * the documentation and/or other materials provided with the 51 | * distribution. 52 | * 53 | * * Neither the name of Stanford University nor the names of its 54 | * contributors may be used to endorse or promote products derived 55 | * from this software without specific prior written permission. 56 | * 57 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 58 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 60 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 61 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 62 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 63 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 64 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 65 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 66 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 67 | * THE POSSIBILITY OF SUCH DAMAGE. 68 | * 69 | * ============================================================================= 70 | */ 71 | 72 | 73 | #ifndef HASH_H 74 | #define HASH_H 1 75 | 76 | 77 | #include "types.h" 78 | 79 | 80 | #ifdef __cplusplus 81 | extern "C" { 82 | #endif 83 | 84 | 85 | /* ============================================================================= 86 | * hash_dbj2 87 | * ============================================================================= 88 | */ 89 | ulong_t 90 | hash_dbj2 (char* str); 91 | 92 | 93 | /* ============================================================================= 94 | * hash_sdbm 95 | * ============================================================================= 96 | */ 97 | ulong_t 98 | hash_sdbm (char* str); 99 | 100 | 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | 106 | #endif /* HASH_H */ 107 | 108 | 109 | /* ============================================================================= 110 | * 111 | * End of hash.h 112 | * 113 | * ============================================================================= 114 | */ 115 | -------------------------------------------------------------------------------- /lib/set.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * set.h 4 | * -- Utility defines to use various data structures as set 5 | * 6 | * ============================================================================= 7 | * 8 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 9 | * Author: Chi Cao Minh 10 | * 11 | * ============================================================================= 12 | * 13 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 14 | * of the files. 15 | * 16 | * ------------------------------------------------------------------------ 17 | * 18 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 19 | * 20 | * ------------------------------------------------------------------------ 21 | * 22 | * For the license of ssca2, please see ssca2/COPYRIGHT 23 | * 24 | * ------------------------------------------------------------------------ 25 | * 26 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 27 | * header of the files. 28 | * 29 | * ------------------------------------------------------------------------ 30 | * 31 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 32 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 33 | * 34 | * ------------------------------------------------------------------------ 35 | * 36 | * Unless otherwise noted, the following license applies to STAMP files: 37 | * 38 | * Copyright (c) 2007, Stanford University 39 | * All rights reserved. 40 | * 41 | * Redistribution and use in source and binary forms, with or without 42 | * modification, are permitted provided that the following conditions are 43 | * met: 44 | * 45 | * * Redistributions of source code must retain the above copyright 46 | * notice, this list of conditions and the following disclaimer. 47 | * 48 | * * Redistributions in binary form must reproduce the above copyright 49 | * notice, this list of conditions and the following disclaimer in 50 | * the documentation and/or other materials provided with the 51 | * distribution. 52 | * 53 | * * Neither the name of Stanford University nor the names of its 54 | * contributors may be used to endorse or promote products derived 55 | * from this software without specific prior written permission. 56 | * 57 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 58 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 60 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 61 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 62 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 63 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 64 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 65 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 66 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 67 | * THE POSSIBILITY OF SUCH DAMAGE. 68 | * 69 | * ============================================================================= 70 | */ 71 | 72 | 73 | #ifndef SET_H 74 | #define SET_H 1 75 | 76 | 77 | #include 78 | #include "types.h" 79 | 80 | 81 | #if defined(SET_USE_RBTREE) 82 | 83 | # include "rbtree.h" 84 | 85 | # define SET_T rbtree_t 86 | # define SET_ALLOC(hash, cmp) rbtree_alloc(cmp) 87 | # define SET_FREE(map) rbtree_free(map) 88 | 89 | # define SET_CONTAINS(map, key) rbtree_contains(map, (void*)(key)) 90 | # define SET_INSERT(map, key) rbtree_insert(map, (void*)(key), NULL) 91 | # define SET_REMOVE(map, key) rbtree_delete(map, (void*)(key)) 92 | 93 | # define TMSET_CONTAINS(map, key) TMRBTREE_CONTAINS(map, (void*)(key)) 94 | # define TMSET_INSERT(map, key) TMRBTREE_INSERT(map, (void*)(key), NULL) 95 | # define TMSET_REMOVE(map, key) TMRBTREE_DELETE(map, (void*)(key)) 96 | 97 | #else 98 | 99 | # error "SET type is not specified" 100 | 101 | #endif 102 | 103 | 104 | #endif /* SET_H */ 105 | 106 | 107 | /* ============================================================================= 108 | * 109 | * End of set.h 110 | * 111 | * ============================================================================= 112 | */ 113 | -------------------------------------------------------------------------------- /lib/timer.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * timer.h 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #ifndef TIMER_H 73 | #define TIMER_H 1 74 | 75 | 76 | #include 77 | 78 | 79 | #define TIMER_T struct timeval 80 | 81 | #define TIMER_READ(time) gettimeofday(&(time), NULL) 82 | 83 | #define TIMER_DIFF_SECONDS(start, stop) \ 84 | (((double)(stop.tv_sec) + (double)(stop.tv_usec / 1000000.0)) - \ 85 | ((double)(start.tv_sec) + (double)(start.tv_usec / 1000000.0))) 86 | 87 | 88 | #endif /* TIMER_H */ 89 | 90 | 91 | /* ============================================================================= 92 | * 93 | * End of timer.h 94 | * 95 | * ============================================================================= 96 | */ 97 | -------------------------------------------------------------------------------- /lib/types.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * types.h 4 | * -- definitions of some types 5 | * 6 | * ============================================================================= 7 | * 8 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 9 | * Author: Chi Cao Minh 10 | * 11 | * ============================================================================= 12 | * 13 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 14 | * of the files. 15 | * 16 | * ------------------------------------------------------------------------ 17 | * 18 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 19 | * 20 | * ------------------------------------------------------------------------ 21 | * 22 | * For the license of ssca2, please see ssca2/COPYRIGHT 23 | * 24 | * ------------------------------------------------------------------------ 25 | * 26 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 27 | * header of the files. 28 | * 29 | * ------------------------------------------------------------------------ 30 | * 31 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 32 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 33 | * 34 | * ------------------------------------------------------------------------ 35 | * 36 | * Unless otherwise noted, the following license applies to STAMP files: 37 | * 38 | * Copyright (c) 2007, Stanford University 39 | * All rights reserved. 40 | * 41 | * Redistribution and use in source and binary forms, with or without 42 | * modification, are permitted provided that the following conditions are 43 | * met: 44 | * 45 | * * Redistributions of source code must retain the above copyright 46 | * notice, this list of conditions and the following disclaimer. 47 | * 48 | * * Redistributions in binary form must reproduce the above copyright 49 | * notice, this list of conditions and the following disclaimer in 50 | * the documentation and/or other materials provided with the 51 | * distribution. 52 | * 53 | * * Neither the name of Stanford University nor the names of its 54 | * contributors may be used to endorse or promote products derived 55 | * from this software without specific prior written permission. 56 | * 57 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 58 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 60 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 61 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 62 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 63 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 64 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 65 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 66 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 67 | * THE POSSIBILITY OF SUCH DAMAGE. 68 | * 69 | * ============================================================================= 70 | */ 71 | 72 | 73 | #ifndef TYPES_H 74 | #define TYPES_H 1 75 | 76 | 77 | #ifdef __cplusplus 78 | extern "C" { 79 | #endif 80 | 81 | 82 | #ifdef SIMULATOR 83 | # undef TRUE 84 | # undef FALSE 85 | # undef bool 86 | #endif 87 | 88 | 89 | typedef unsigned long ulong_t; 90 | 91 | enum { 92 | FALSE = 0, 93 | TRUE = 1 94 | }; 95 | 96 | typedef long bool_t; 97 | 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | 104 | #endif /* TYPES_H */ 105 | 106 | 107 | /* ============================================================================= 108 | * 109 | * End of types.h 110 | * 111 | * ============================================================================= 112 | */ 113 | -------------------------------------------------------------------------------- /lib/utility.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * utility.h 4 | * -- Collection of utility macros 5 | * 6 | * ============================================================================= 7 | * 8 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 9 | * Author: Chi Cao Minh 10 | * 11 | * ============================================================================= 12 | * 13 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 14 | * of the files. 15 | * 16 | * ------------------------------------------------------------------------ 17 | * 18 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 19 | * 20 | * ------------------------------------------------------------------------ 21 | * 22 | * For the license of ssca2, please see ssca2/COPYRIGHT 23 | * 24 | * ------------------------------------------------------------------------ 25 | * 26 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 27 | * header of the files. 28 | * 29 | * ------------------------------------------------------------------------ 30 | * 31 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 32 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 33 | * 34 | * ------------------------------------------------------------------------ 35 | * 36 | * Unless otherwise noted, the following license applies to STAMP files: 37 | * 38 | * Copyright (c) 2007, Stanford University 39 | * All rights reserved. 40 | * 41 | * Redistribution and use in source and binary forms, with or without 42 | * modification, are permitted provided that the following conditions are 43 | * met: 44 | * 45 | * * Redistributions of source code must retain the above copyright 46 | * notice, this list of conditions and the following disclaimer. 47 | * 48 | * * Redistributions in binary form must reproduce the above copyright 49 | * notice, this list of conditions and the following disclaimer in 50 | * the documentation and/or other materials provided with the 51 | * distribution. 52 | * 53 | * * Neither the name of Stanford University nor the names of its 54 | * contributors may be used to endorse or promote products derived 55 | * from this software without specific prior written permission. 56 | * 57 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 58 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 60 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 61 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 62 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 63 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 64 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 65 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 66 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 67 | * THE POSSIBILITY OF SUCH DAMAGE. 68 | * 69 | * ============================================================================= 70 | */ 71 | 72 | 73 | #ifndef UTILITY_H 74 | #define UTILITY_H 75 | 76 | 77 | #ifdef SIMULATOR 78 | # undef MAX 79 | # undef MIN 80 | #endif 81 | 82 | 83 | #define MAX(a,b) \ 84 | ({ \ 85 | typeof(a) _a = (a); \ 86 | typeof(b) _b = (b); \ 87 | (_a > _b) ? (_a) : (_b); \ 88 | }) 89 | 90 | #define MIN(a,b) \ 91 | ({ \ 92 | typeof(a) _a = (a); \ 93 | typeof(b) _b = (b); \ 94 | (_a < _b) ? (_a) : (_b); \ 95 | }) 96 | 97 | #define DIVIDE_AND_ROUND_UP(a,b) \ 98 | ({ \ 99 | typeof(a) _a = (a); \ 100 | typeof(b) _b = (b); \ 101 | (_a / _b) + (((_a % _b) > 0) ? (1) : (0)); \ 102 | }) 103 | 104 | 105 | #endif /* UTILITY_H */ 106 | 107 | 108 | /* ============================================================================= 109 | * 110 | * End of utility.h 111 | * 112 | * ============================================================================= 113 | */ 114 | 115 | -------------------------------------------------------------------------------- /ssca2/Defines.common.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.mk 4 | # 5 | # ============================================================================== 6 | 7 | 8 | PROG := ssca2 9 | 10 | SRCS += \ 11 | alg_radix_smp.c \ 12 | computeGraph.c \ 13 | createPartition.c \ 14 | cutClusters.c \ 15 | findSubGraphs.c \ 16 | genScalData.c \ 17 | getStartLists.c \ 18 | getUserParameters.c \ 19 | globals.c \ 20 | ssca2.c \ 21 | $(LIB)/mt19937ar.c \ 22 | $(LIB)/random.c \ 23 | $(LIB)/thread.c \ 24 | # 25 | OBJS := ${SRCS:.c=.o} 26 | 27 | #CFLAGS += -DUSE_PARALLEL_DATA_GENERATION 28 | #CFLAGS += -DWRITE_RESULT_FILES 29 | CFLAGS += -DENABLE_KERNEL1 30 | #CFLAGS += -DENABLE_KERNEL2 -DENABLE_KERNEL3 31 | #CFLAGS += -DENABLE_KERNEL4 32 | 33 | 34 | # ============================================================================== 35 | # 36 | # End of Defines.common.mk 37 | # 38 | # ============================================================================== 39 | -------------------------------------------------------------------------------- /ssca2/Makefile.orig: -------------------------------------------------------------------------------- 1 | EXECS = RUN_graphAnalysis 2 | 3 | SIMPLE_DIR = ../simple-4.4H 4 | 5 | OPT = -O$(O_LEVEL) 6 | OPT = -g 7 | 8 | include $(SIMPLE_DIR)/Makefile.smp.mk 9 | -------------------------------------------------------------------------------- /ssca2/Makefile.seq: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.seq 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.seq 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # Makefile.seq 16 | # 17 | # ============================================================================== 18 | 19 | -------------------------------------------------------------------------------- /ssca2/Makefile.stm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /ssca2/Makefile.stm.otm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm.otm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.otm.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm.otm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm.otm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /ssca2/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/ssca2/README -------------------------------------------------------------------------------- /ssca2/computeGraph.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * computeGraph.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #ifndef COMPUTEGRAPH_H 68 | #define COMPUTEGRAPH_H 1 69 | 70 | 71 | #include "defs.h" 72 | 73 | 74 | typedef struct computeGragh_arg { 75 | graph* GPtr; 76 | graphSDG* SDGdataPtr; 77 | } computeGraph_arg_t; 78 | 79 | 80 | /* ============================================================================= 81 | * computeGraph 82 | * ============================================================================= 83 | */ 84 | void 85 | computeGraph (void* argPtr); 86 | 87 | 88 | #endif /* COMPUTEGRAPH_H */ 89 | 90 | 91 | /* ============================================================================= 92 | * 93 | * End of computeGraph.h 94 | * 95 | * ============================================================================= 96 | */ 97 | -------------------------------------------------------------------------------- /ssca2/createPartition.c: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * createPartition.c 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | #include "createPartition.h" 67 | #include "utility.h" 68 | 69 | 70 | /* ============================================================================= 71 | * createPartition 72 | * ============================================================================= 73 | */ 74 | void 75 | createPartition (long min, long max, long id, long n, 76 | long* startPtr, long* stopPtr) 77 | { 78 | long range = max - min; 79 | long chunk = MAX(1, ((range + n/2) / n)); /* rounded */ 80 | long start = min + chunk * id; 81 | long stop; 82 | if (id == (n-1)) { 83 | stop = max; 84 | } else { 85 | stop = MIN(max, (start + chunk)); 86 | } 87 | 88 | *startPtr = start; 89 | *stopPtr = stop; 90 | } 91 | 92 | 93 | /* ============================================================================= 94 | * 95 | * End of createPartition.c 96 | * 97 | * ============================================================================= 98 | */ 99 | -------------------------------------------------------------------------------- /ssca2/createPartition.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * createPartition.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #ifndef CREATEPARTITION_H 68 | #define CREATEPARTITION_H 1 69 | 70 | 71 | /* ============================================================================= 72 | * createPartition 73 | * ============================================================================= 74 | */ 75 | void 76 | createPartition (long min, long max, long id, long n, 77 | long* startPtr, long* stopPtr); 78 | 79 | 80 | #endif /* CREATEPARTITION_H */ 81 | 82 | 83 | /* ============================================================================= 84 | * 85 | * End of createPartition.h 86 | * 87 | * ============================================================================= 88 | */ 89 | -------------------------------------------------------------------------------- /ssca2/cutClusters.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * cutClusters.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #ifndef CUTCLUSTERS_H 68 | #define CUTCLUSTERS_H 69 | 70 | 71 | #include "defs.h" 72 | 73 | 74 | /* ============================================================================= 75 | * cutClusters 76 | * ============================================================================= 77 | */ 78 | void 79 | cutClusters (void* argPtr); 80 | 81 | 82 | #endif /* CUTCLUSTERS_H */ 83 | 84 | 85 | /* ============================================================================= 86 | * 87 | * End of cutClusters.h 88 | * 89 | * ============================================================================= 90 | */ 91 | -------------------------------------------------------------------------------- /ssca2/genScalData.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * genScalData.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #ifndef GETSCALDATA_H 68 | #define GETSCALDATA_H 1 69 | 70 | 71 | #include "defs.h" 72 | 73 | 74 | /* ============================================================================= 75 | * genScalData_seq 76 | * ============================================================================= 77 | */ 78 | void 79 | genScalData_seq (graphSDG* SDGdataPtr); 80 | 81 | 82 | /* ============================================================================= 83 | * genScalData 84 | * ============================================================================= 85 | */ 86 | void 87 | genScalData (void* argPtr); 88 | 89 | 90 | #endif /* GETSCALDATA_H */ 91 | 92 | 93 | /* ============================================================================= 94 | * 95 | * End of genScalData.h 96 | * 97 | * ============================================================================= 98 | */ 99 | -------------------------------------------------------------------------------- /ssca2/getStartLists.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * getStartLists.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #ifndef GETSTARTLISTS_H 68 | #define GETSTARTLISTS_H 1 69 | 70 | 71 | typedef struct getStartLists_arg { 72 | graph* GPtr; 73 | edge** maxIntWtListPtr; 74 | long* maxIntWtListSize; 75 | edge** soughtStrWtListPtr; 76 | long* soughtStrWtListSize; 77 | } getStartLists_arg_t; 78 | 79 | 80 | /* ============================================================================= 81 | * getStartLists 82 | * ============================================================================= 83 | */ 84 | void 85 | getStartLists (void* argPtr); 86 | 87 | 88 | #endif /* GETSTARTLISTS_H */ 89 | 90 | 91 | /* ============================================================================= 92 | * 93 | * End of getStartLists.h 94 | * 95 | * ============================================================================= 96 | */ 97 | -------------------------------------------------------------------------------- /ssca2/getUserParameters.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * getUserParameters.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #ifndef GETUSERPARAMETERS_H 68 | #define GETUSERPARAMETERS_H 1 69 | 70 | 71 | /* ============================================================================= 72 | * getUserParameters 73 | * ============================================================================= 74 | */ 75 | void 76 | getUserParameters (long argc, char* const argv[]); 77 | 78 | 79 | #endif /* GETUSERPARAMETERS_H */ 80 | 81 | 82 | /* ============================================================================= 83 | * 84 | * End of getUserParameters.h 85 | * 86 | * ============================================================================= 87 | */ 88 | -------------------------------------------------------------------------------- /ssca2/globals.c: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * globals.c 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #include "defs.h" 68 | #include "globals.h" 69 | 70 | long SCALE; 71 | ULONGINT_T TOT_VERTICES; 72 | long MAX_CLIQUE_SIZE; 73 | long MAX_PARAL_EDGES; 74 | ULONGINT_T MAX_INT_WEIGHT; 75 | char* SOUGHT_STRING; 76 | long MAX_STRLEN; 77 | float PERC_INT_WEIGHTS; 78 | float PROB_UNIDIRECTIONAL; 79 | float PROB_INTERCL_EDGES; 80 | long SUBGR_EDGE_LENGTH; 81 | long MAX_CLUSTER_SIZE; 82 | long MAX_STRLEN; 83 | long K3_DS; 84 | long THREADS; 85 | 86 | 87 | /* ============================================================================= 88 | * 89 | * End of globals.c 90 | * 91 | * ============================================================================= 92 | */ 93 | -------------------------------------------------------------------------------- /ssca2/globals.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * globals.h 4 | * 5 | * ============================================================================= 6 | * 7 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 8 | * of the files. 9 | * 10 | * ------------------------------------------------------------------------ 11 | * 12 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 13 | * 14 | * ------------------------------------------------------------------------ 15 | * 16 | * For the license of ssca2, please see ssca2/COPYRIGHT 17 | * 18 | * ------------------------------------------------------------------------ 19 | * 20 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 21 | * header of the files. 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 26 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * Unless otherwise noted, the following license applies to STAMP files: 31 | * 32 | * Copyright (c) 2007, Stanford University 33 | * All rights reserved. 34 | * 35 | * Redistribution and use in source and binary forms, with or without 36 | * modification, are permitted provided that the following conditions are 37 | * met: 38 | * 39 | * * Redistributions of source code must retain the above copyright 40 | * notice, this list of conditions and the following disclaimer. 41 | * 42 | * * Redistributions in binary form must reproduce the above copyright 43 | * notice, this list of conditions and the following disclaimer in 44 | * the documentation and/or other materials provided with the 45 | * distribution. 46 | * 47 | * * Neither the name of Stanford University nor the names of its 48 | * contributors may be used to endorse or promote products derived 49 | * from this software without specific prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 56 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 57 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 58 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 59 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 61 | * THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | * ============================================================================= 64 | */ 65 | 66 | 67 | #ifndef GLOBALS_H 68 | #define GLOBALS_H 1 69 | 70 | #include "defs.h" 71 | 72 | 73 | extern long SCALE; 74 | extern ULONGINT_T TOT_VERTICES; 75 | 76 | extern long MAX_CLIQUE_SIZE; 77 | extern long MAX_PARAL_EDGES; 78 | extern float PROB_UNIDIRECTIONAL; 79 | extern float PROB_INTERCL_EDGES; 80 | 81 | extern float PERC_INT_WEIGHTS; 82 | 83 | extern ULONGINT_T MAX_INT_WEIGHT; 84 | extern char* SOUGHT_STRING; 85 | 86 | extern long MAX_STRLEN; 87 | 88 | extern long SUBGR_EDGE_LENGTH; 89 | extern long MAX_CLUSTER_SIZE; 90 | 91 | extern long K3_DS; 92 | 93 | extern long THREADS; 94 | 95 | 96 | #endif /* GLOBALS_H */ 97 | 98 | 99 | /* ============================================================================= 100 | * 101 | * End of globals.h 102 | * 103 | * ============================================================================= 104 | */ 105 | -------------------------------------------------------------------------------- /vacation/Defines.common.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.mk 4 | # 5 | # ============================================================================== 6 | 7 | 8 | CFLAGS += -DLIST_NO_DUPLICATES 9 | CFLAGS += -DMAP_USE_RBTREE 10 | 11 | PROG := vacation 12 | 13 | SRCS += \ 14 | client.c \ 15 | customer.c \ 16 | manager.c \ 17 | reservation.c \ 18 | vacation.c \ 19 | $(LIB)/list.c \ 20 | $(LIB)/pair.c \ 21 | $(LIB)/mt19937ar.c \ 22 | $(LIB)/random.c \ 23 | $(LIB)/rbtree.c \ 24 | $(LIB)/thread.c \ 25 | # 26 | OBJS := ${SRCS:.c=.o} 27 | 28 | 29 | # ============================================================================== 30 | # 31 | # End of Defines.common.mk 32 | # 33 | # ============================================================================== 34 | -------------------------------------------------------------------------------- /vacation/Makefile.seq: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.seq 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.seq 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # Makefile.seq 16 | # 17 | # ============================================================================== 18 | 19 | -------------------------------------------------------------------------------- /vacation/Makefile.stm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /vacation/Makefile.stm.otm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm.otm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.otm.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm.otm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm.otm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /vacation/README: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | This benchmark implements a travel reservation system powered by a 5 | non-distributed database. The workload consists of several client threads 6 | interacting with the database via the system's transaction manager. 7 | 8 | The database is consists of four tables: cars, rooms, flights, and customers. 9 | The first three have relations with fields representing a unique ID number, 10 | reserved quantity, total available quantity, and price. The table of customers 11 | tracks the reservations made by each customer and the total price of the 12 | reservations they made. The tables are implemented as Red-Black trees. 13 | 14 | When using this benchmark, please cite [1]. 15 | 16 | 17 | Compiling and Running 18 | --------------------- 19 | 20 | To build the application, simply run: 21 | 22 | make -f 23 | 24 | in the source directory. For example, for the sequential flavor, run: 25 | 26 | make -f Makefile.seq 27 | 28 | By default, this produces an executable named "vacation", which can then be 29 | run in the following manner: 30 | 31 | ./vacation -n \ 32 | -q <%_of_relations_queried> \ 33 | -r \ 34 | -u <%_of_user_tasks> \ 35 | -t 36 | 37 | The following values are recommended for simulated runs: 38 | 39 | low contention: -n2 -q90 -u98 -r16384 -t4096 40 | high contention: -n4 -q60 -u90 -r16384 -t4096 41 | 42 | For non-simulator runs, larger values for -r and -t can be used: 43 | 44 | low contention: -n2 -q90 -u98 -r1048576 -t4194304 45 | high contention: -n4 -q60 -u90 -r1048576 -t4194304 46 | 47 | 48 | Workload Characteristics 49 | ------------------------ 50 | 51 | The initial size of the database is determined by -r, which is the number of 52 | entries with which the tree will be initialized. The number of total tasks that 53 | the travel reservation system performs is controlled by -t. There are four 54 | different possible tasks: 55 | 56 | 1) Make Reservation -- The client checks the price of -n items, and 57 | reserves a few of them. 58 | 59 | 2) Delete Customer -- The total cost of a customer's reservations is 60 | computed and then the customer is removed from the system. 61 | 62 | 3) Add to Item Tables -- Add -n new items for reservation, where 63 | an item is one of {car, flight, room} and has a unique ID number. 64 | 65 | 4) Remove from Item Tables -- Remove -n new items for reservation, where 66 | an item is one of {car, flight, room} and has a unique ID number. 67 | 68 | The distribution of tasks can be adjusted with the -u option. For example, 69 | an argument of U gives the following distribution: 70 | 71 | U % ---------- Make Reservation 72 | (100-U)/2 % -- Delete Customer 73 | (100-U)/4 % -- Add to Item Tables 74 | (100-U)/4 % -- Remove from Item Tables 75 | 76 | The -q option controls the range of values from which the clients generate 77 | queries; thus, smaller values for -q generate higher contention workloads. 78 | 79 | 80 | References 81 | ---------- 82 | 83 | [1] C. Cao Minh, J. Chung, C. Kozyrakis, and K. Olukotun. STAMP: Stanford 84 | Transactional Applications for Multi-processing. In IISWC '08: Proceedings 85 | of The IEEE International Symposium on Workload Characterization, 86 | September 2008. 87 | -------------------------------------------------------------------------------- /vacation/action.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * action.h 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #ifndef ACTION_H 73 | #define ACTION_H 1 74 | 75 | 76 | typedef enum action { 77 | ACTION_MAKE_RESERVATION = 0, 78 | ACTION_DELETE_CUSTOMER = 1, 79 | ACTION_UPDATE_TABLES = 2, 80 | NUM_ACTION 81 | } action_t; 82 | 83 | 84 | #endif /* ACTION_H */ 85 | 86 | 87 | /* ============================================================================= 88 | * 89 | * End of action.h 90 | * 91 | * ============================================================================= 92 | */ 93 | -------------------------------------------------------------------------------- /vacation/operation.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================= 2 | * 3 | * operation.h 4 | * 5 | * ============================================================================= 6 | * 7 | * Copyright (C) Stanford University, 2006. All Rights Reserved. 8 | * Author: Chi Cao Minh 9 | * 10 | * ============================================================================= 11 | * 12 | * For the license of bayes/sort.h and bayes/sort.c, please see the header 13 | * of the files. 14 | * 15 | * ------------------------------------------------------------------------ 16 | * 17 | * For the license of kmeans, please see kmeans/LICENSE.kmeans 18 | * 19 | * ------------------------------------------------------------------------ 20 | * 21 | * For the license of ssca2, please see ssca2/COPYRIGHT 22 | * 23 | * ------------------------------------------------------------------------ 24 | * 25 | * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the 26 | * header of the files. 27 | * 28 | * ------------------------------------------------------------------------ 29 | * 30 | * For the license of lib/rbtree.h and lib/rbtree.c, please see 31 | * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree 32 | * 33 | * ------------------------------------------------------------------------ 34 | * 35 | * Unless otherwise noted, the following license applies to STAMP files: 36 | * 37 | * Copyright (c) 2007, Stanford University 38 | * All rights reserved. 39 | * 40 | * Redistribution and use in source and binary forms, with or without 41 | * modification, are permitted provided that the following conditions are 42 | * met: 43 | * 44 | * * Redistributions of source code must retain the above copyright 45 | * notice, this list of conditions and the following disclaimer. 46 | * 47 | * * Redistributions in binary form must reproduce the above copyright 48 | * notice, this list of conditions and the following disclaimer in 49 | * the documentation and/or other materials provided with the 50 | * distribution. 51 | * 52 | * * Neither the name of Stanford University nor the names of its 53 | * contributors may be used to endorse or promote products derived 54 | * from this software without specific prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY 57 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 59 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | * THE POSSIBILITY OF SUCH DAMAGE. 67 | * 68 | * ============================================================================= 69 | */ 70 | 71 | 72 | #ifndef OPERATION_H 73 | #define OPERATION_H 1 74 | 75 | typedef enum operation { 76 | OPERATION_MAKE_RESERVATION = 0L, 77 | OPERATION_DELETE_CUSTOMER = 1L, 78 | OPERATION_UPDATE_TABLE = 2L, 79 | NUM_OPERATION 80 | } operation_t; 81 | 82 | #endif /* OPERATION_H */ 83 | 84 | 85 | /* ============================================================================= 86 | * 87 | * End of operation.h 88 | * 89 | * ============================================================================= 90 | */ 91 | -------------------------------------------------------------------------------- /yada/Defines.common.mk: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Defines.common.mk 4 | # 5 | # ============================================================================== 6 | 7 | 8 | CFLAGS += -DLIST_NO_DUPLICATES 9 | CFLAGS += -DMAP_USE_AVLTREE 10 | CFLAGS += -DSET_USE_RBTREE 11 | 12 | PROG := yada 13 | SRCS += \ 14 | coordinate.c \ 15 | element.c \ 16 | mesh.c \ 17 | region.c \ 18 | yada.c \ 19 | $(LIB)/avltree.c \ 20 | $(LIB)/heap.c \ 21 | $(LIB)/list.c \ 22 | $(LIB)/mt19937ar.c \ 23 | $(LIB)/pair.c \ 24 | $(LIB)/queue.c \ 25 | $(LIB)/random.c \ 26 | $(LIB)/rbtree.c \ 27 | $(LIB)/thread.c \ 28 | $(LIB)/vector.c \ 29 | # 30 | OBJS := ${SRCS:.c=.o} 31 | 32 | 33 | # ============================================================================== 34 | # 35 | # End of Defines.common.mk 36 | # 37 | # ============================================================================== 38 | -------------------------------------------------------------------------------- /yada/Makefile.seq: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.seq 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.seq 11 | 12 | .PHONY: test_coordinate 13 | test_coordinate: CFLAGS += -DTEST_COORDINATE 14 | test_coordinate: 15 | $(CC) $(CFLAGS) coordinate.c -lm -o $@ 16 | 17 | .PHONY: test_element 18 | test_element: CFLAGS += -DTEST_ELEMENT 19 | test_element: LIB_SRCS := $(LIB)/{heap,list,pair,avltree}.c 20 | test_element: 21 | $(CC) $(CFLAGS) element.c coordinate.c $(LIB_SRCS) -lm -o $@ 22 | 23 | .PHONY: test_mesh 24 | test_mesh: CFLAGS += -DTEST_MESH 25 | test_mesh: LIB_SRCS := $(LIB)/{heap,list,pair,avltree,queue,rbtree,random,mt19937ar}.c 26 | test_mesh: 27 | $(CC) $(CFLAGS) mesh.c element.c coordinate.c $(LIB_SRCS) -lm -o $@ 28 | 29 | 30 | # ============================================================================== 31 | # 32 | # Makefile.seq 33 | # 34 | # ============================================================================== 35 | 36 | -------------------------------------------------------------------------------- /yada/Makefile.stm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /yada/Makefile.stm.otm: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # 3 | # Makefile.stm.otm 4 | # 5 | # ============================================================================== 6 | 7 | 8 | include ../common/Defines.common.otm.mk 9 | include ./Defines.common.mk 10 | include ../common/Makefile.stm.otm 11 | 12 | 13 | # ============================================================================== 14 | # 15 | # End of Makefile.stm.otm 16 | # 17 | # ============================================================================== 18 | -------------------------------------------------------------------------------- /yada/README: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | This benchmark implements Ruppert's algorithm for Delaunay mesh refinement [3]. 5 | The transactional version is similar in design to the one presented in [2]. 6 | 7 | When using this benchmark, please cite [1]. 8 | 9 | 10 | Compiling and Running 11 | --------------------- 12 | 13 | To build the application, simply run: 14 | 15 | make -f 16 | 17 | in the source directory. For example, for the sequential flavor, run: 18 | 19 | make -f Makefile.seq 20 | 21 | By default, this produces an executable named "yada", which can then be 22 | run in the following manner: 23 | 24 | ./yada -a \ 25 | -i \ 26 | -t 27 | 28 | Where is the prefix of a set of three files which contain the 29 | vertices of the input mesh, the triangles in the input mesh, and the boundary of 30 | the input mesh, with suffixes ".node", ".ele", and ".poly", respectively. 31 | 32 | The default is 1 and the default 33 | is 20 degrees. In practice, Ruppert's algorithm can easily achieve an 34 | angle constraing of about 20 degrees, but it rarely improves it much beyond 35 | 30 degrees. 36 | 37 | 38 | Input Files 39 | ----------- 40 | 41 | There are six different input files in "inputs". From smallest to largest, 42 | these are spiral, dots, ladder, 633, ttimeu10000, and ttimeu10000. All input 43 | files are courtesy of Jonathan Shewchuck. 44 | 45 | To produce additional inputs, you can use the program, Triangle [4]: 46 | 47 | ./triangle a 48 | ./triangle -c a.1 49 | 50 | This will generate the files "a.2.node", "a.2.ele", and "a.2.poly", which 51 | can then be used as inputs for this benchmark. 52 | 53 | For simulated runs, use: 54 | 55 | -a20 -i inputs/633.2 56 | 57 | And for non-simulator runs, use: 58 | 59 | -a15 -i inputs/ttimeu1000000.2 60 | 61 | 62 | References 63 | ---------- 64 | 65 | [1] C. Cao Minh, J. Chung, C. Kozyrakis, and K. Olukotun. STAMP: Stanford 66 | Transactional Applications for Multi-processing. In IISWC '08: Proceedings 67 | of The IEEE International Symposium on Workload Characterization, 68 | September 2008. 69 | 70 | [2] M. Kulkarni, L. Paul Chew, and K. Pingail. Using Transactions in Delaunay 71 | Mesh Generation. Workshop on Transactional Memory Workloads, 2006. 72 | 73 | [3] J. Ruppert. A Delaunay Refinement Algorithm for Quality 2-Dimensional 74 | Mesh Generation. J. Algorithms 18, 3 (May. 1995), 548-585. 75 | 76 | [4] J. R. Shewchuck. Triangle: A Two-Dimensional Quality Mesh Generator and 77 | Delaunay Triangulator. http://www.cs.cmu.edu/~quake/triangle.html 78 | -------------------------------------------------------------------------------- /yada/inputs/633.2.ele.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/633.2.ele.gz -------------------------------------------------------------------------------- /yada/inputs/633.2.node.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/633.2.node.gz -------------------------------------------------------------------------------- /yada/inputs/633.2.poly.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/633.2.poly.gz -------------------------------------------------------------------------------- /yada/inputs/dots.2.ele.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/dots.2.ele.gz -------------------------------------------------------------------------------- /yada/inputs/dots.2.node.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/dots.2.node.gz -------------------------------------------------------------------------------- /yada/inputs/dots.2.poly.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/dots.2.poly.gz -------------------------------------------------------------------------------- /yada/inputs/ladder.2.ele.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ladder.2.ele.gz -------------------------------------------------------------------------------- /yada/inputs/ladder.2.node.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ladder.2.node.gz -------------------------------------------------------------------------------- /yada/inputs/ladder.2.poly.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ladder.2.poly.gz -------------------------------------------------------------------------------- /yada/inputs/spiral.2.ele.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/spiral.2.ele.gz -------------------------------------------------------------------------------- /yada/inputs/spiral.2.node.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/spiral.2.node.gz -------------------------------------------------------------------------------- /yada/inputs/spiral.2.poly.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/spiral.2.poly.gz -------------------------------------------------------------------------------- /yada/inputs/ttimeu10000.2.ele.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ttimeu10000.2.ele.gz -------------------------------------------------------------------------------- /yada/inputs/ttimeu10000.2.node.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ttimeu10000.2.node.gz -------------------------------------------------------------------------------- /yada/inputs/ttimeu10000.2.poly.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ttimeu10000.2.poly.gz -------------------------------------------------------------------------------- /yada/inputs/ttimeu100000.2.ele.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ttimeu100000.2.ele.gz -------------------------------------------------------------------------------- /yada/inputs/ttimeu100000.2.node.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ttimeu100000.2.node.gz -------------------------------------------------------------------------------- /yada/inputs/ttimeu100000.2.poly.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ttimeu100000.2.poly.gz -------------------------------------------------------------------------------- /yada/inputs/ttimeu1000000.2.ele.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ttimeu1000000.2.ele.gz -------------------------------------------------------------------------------- /yada/inputs/ttimeu1000000.2.node.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ttimeu1000000.2.node.gz -------------------------------------------------------------------------------- /yada/inputs/ttimeu1000000.2.poly.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kozyraki/stamp/9222e2707e598448d90112991a3a90544469d4b4/yada/inputs/ttimeu1000000.2.poly.gz --------------------------------------------------------------------------------