diff --git a/CMakeLists.txt b/CMakeLists.txt index 095d6d8..b0c5663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,4 +59,5 @@ include_directories("${PROJECT_SOURCE_DIR}/include") include_directories("${PROJECT_SOURCE_DIR}/ext") include_directories("${PROJECT_SOURCE_DIR}/ext/cxx-prettyprint") +# build tests add_subdirectory(test) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5b14596 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2015 Georgia Institute of Technology + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/README.md b/README.md index 7e90551..3d608a8 100644 --- a/README.md +++ b/README.md @@ -138,32 +138,6 @@ To our knowledge, there are two noteworthy, similar open libraries available. - Patrick Flick -### Code organization - -The implementation is split into multiple headers: - -- [`algos.hpp`](algos.hpp) implements sequential algorithms, used only - internally in `mxx`. -- [`collective.hpp`](collective.hpp) C++ wrappers around MPI collective - operations. At this time supports `all2all`, `gather/allgather`, - `scatter`, `reduce/allreduce`, `scan`, `exscan`. -- [`datatypes.hpp`](datatypes.hpp) C++ type mapping to `MPI_Datatype`. This - supports all basic `C` datatypes and `std::array`, `std::pair`, `std::tuple`, - and further provides methods for users to supply their own datatype in a - simplified fashion. -- [`distribution.hpp`](distribution.hpp) implements functions for data - distribution (e.g., equally distributing data among processors) -- [`file.hpp`](file.hpp) implements some functionality for parallel reading and - writing of files. There is not much in there yet. -- [`samplesort.hpp`](samplesort.hpp) implements the sample sort algorithm for - parallel distributed sorting. This is an internal file. For usage of - `mxx::sort`, see `sort.hpp`. -- [`shift.hpp`](shift.hpp) implements simple wrappers for shift communication. -- [`sort.hpp`](sort.hpp) implements the `mxx::sort` function. -- [`utils.hpp`](utils.hpp) implements some utility functions, such as `gdb` - interaction and printing of node/rank distribution for large jobs. - - ## Installation Since this is a header only library, simply copy and paste the `mxx` folder into @@ -180,9 +154,24 @@ work on data sizes `>= 2 GB` only with `MPI-3`. Not necessary. This is a header only library. There is nothing to compile. -At some point, we will add some examples, and then say how these examples can be -built. +#### Building tests + +The tests can be compiled using `cmake`: + +```sh +mkdir build && cd build +cmake ../ && make +``` + +Running the tests (with however many processes you want). +``` +mpirun -np 13 ./bin/test-all +``` + ## Licensing -TBD +Our code is licensed under the +*Apache License 2.0* (see [`LICENSE`](LICENSE)). +The licensing does not apply to the `ext` folder, which contains external +dependencies which are under their own licensing terms. diff --git a/include/mxx/algos.hpp b/include/mxx/algos.hpp index ddfc99d..c1de921 100644 --- a/include/mxx/algos.hpp +++ b/include/mxx/algos.hpp @@ -1,12 +1,25 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file algos.hpp * @author Nagakishore Jammula * @author Patrick Flick * @brief Implements some common sequential algorithms * - * Copyright (c) TODO - * - * TODO add Licence */ #ifndef HPC_ALGOS_H diff --git a/include/mxx/big_collective.hpp b/include/mxx/big_collective.hpp index 6539a37..cfe18e4 100644 --- a/include/mxx/big_collective.hpp +++ b/include/mxx/big_collective.hpp @@ -1,14 +1,24 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file big_collective.hpp * @author Patrick Flick * @group collective * @brief Implementations of big (> INT_MAX) collective operations. - * - * @detail - * - * Copyright (c) 2015 Georgia Institute of Technology. All Rights Reserved. - * - * TODO add Licence */ #ifndef MXX_BIG_COLLECTIVE_HPP diff --git a/include/mxx/collective.hpp b/include/mxx/collective.hpp index 2bb2dba..db732bc 100644 --- a/include/mxx/collective.hpp +++ b/include/mxx/collective.hpp @@ -1,14 +1,25 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file collective.hpp * @author Patrick Flick * @group collective * @brief Collective operations. * - * @detail - * - * Copyright (c) 2015 Georgia Institute of Technology. All Rights Reserved. - * - * TODO add Licence */ #ifndef MXX_COLLECTIVE_HPP diff --git a/include/mxx/comm.hpp b/include/mxx/comm.hpp index 5655ea6..e0c0178 100644 --- a/include/mxx/comm.hpp +++ b/include/mxx/comm.hpp @@ -1,11 +1,23 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file comm.hpp * @author Patrick Flick * @brief Implements a wrapper for MPI_Comm. - * - * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. - * - * TODO add Licence */ #ifndef MXX_COMM_HPP diff --git a/include/mxx/comm_def.hpp b/include/mxx/comm_def.hpp index 849eef2..8dee8e2 100644 --- a/include/mxx/comm_def.hpp +++ b/include/mxx/comm_def.hpp @@ -1,3 +1,19 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef MXX_COMM_FWD_HPP #error "Never include this file directly" #endif @@ -16,7 +32,7 @@ namespace mxx { -comm comm::split_shared() const { +inline comm comm::split_shared() const { comm o; #if MPI_VERSION >= 3 // use Comm_split_type to split into shared memory subcommunicators diff --git a/include/mxx/comm_fwd.hpp b/include/mxx/comm_fwd.hpp index 4b3555a..36eed43 100644 --- a/include/mxx/comm_fwd.hpp +++ b/include/mxx/comm_fwd.hpp @@ -1,11 +1,23 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file comm.hpp * @author Patrick Flick * @brief Implements a wrapper for MPI_Comm. - * - * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. - * - * TODO add Licence */ #ifndef MXX_COMM_FWD_HPP @@ -303,6 +315,7 @@ class comm { /********** * Recv * **********/ + // TODO: recv should also return a `status`, so that we can known which tag and src the message is from // recv single element and return template diff --git a/include/mxx/common.hpp b/include/mxx/common.hpp index 06fcada..d2b32be 100644 --- a/include/mxx/common.hpp +++ b/include/mxx/common.hpp @@ -1,3 +1,19 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef MXX_COMMON_HPP #define MXX_COMMON_HPP @@ -18,7 +34,6 @@ constexpr size_t max_int = std::numeric_limits::max(); // check type of MPI_Aint static_assert(sizeof(size_t) == sizeof(MPI_Aint), "MPI_Aint must be the same size as size_t"); - // assertion failure inline void assert_fail(const char * cond, const char* file, int line, const char* func) { int rank; diff --git a/include/mxx/datatypes.hpp b/include/mxx/datatypes.hpp index 861665c..c566171 100644 --- a/include/mxx/datatypes.hpp +++ b/include/mxx/datatypes.hpp @@ -1,11 +1,23 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file datatypes.hpp * @author Patrick Flick * @brief MPI Datatypes for C++ types. - * - * Copyright (c) TODO - * - * TODO add Licence */ #ifndef MXX_DATATYPES_HPP diff --git a/include/mxx/distribution.hpp b/include/mxx/distribution.hpp index 4b60692..971f6e5 100644 --- a/include/mxx/distribution.hpp +++ b/include/mxx/distribution.hpp @@ -1,10 +1,23 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** - * @file paritition.hpp + * @file distribution.hpp * @author Patrick Flick - * @brief Implements the partition API and different data partitions, most - * notably the block decomposition. - * - * TODO add Licence + * @brief Implements functions to redistribute data across processes. */ #ifndef MXX_DISTRIBUTION_HPP diff --git a/include/mxx/file.hpp b/include/mxx/file.hpp index a541f24..391a411 100644 --- a/include/mxx/file.hpp +++ b/include/mxx/file.hpp @@ -1,11 +1,28 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file file.hpp * @author Patrick Flick * @brief Block decompose and distribute file as string on MPI communicator. * - * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. - * - * TODO add Licence + * This is not a substitute for MPI_File functionality. + * TODO: + * - [ ] Implement proper MPI_File functions for parallel reading of files + * - [ ] HDF5 ? */ #ifndef MXX_FILE_HPP diff --git a/include/mxx/future.hpp b/include/mxx/future.hpp index 359000a..58a4087 100644 --- a/include/mxx/future.hpp +++ b/include/mxx/future.hpp @@ -1,11 +1,22 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @file future.hpp * @author Patrick Flick - * @brief Request wrappers and mxx::future. - * - * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. - * - * TODO add Licence + * @brief Implements request wrappers and mxx::future. */ #ifndef MXX_FUTURE_HPP diff --git a/include/mxx/partition.hpp b/include/mxx/partition.hpp index c30d6a5..bc9b0c2 100644 --- a/include/mxx/partition.hpp +++ b/include/mxx/partition.hpp @@ -1,10 +1,24 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file paritition.hpp * @author Patrick Flick * @brief Implements the partition API and different data partitions, most * notably the block decomposition. - * - * TODO add Licence */ #ifndef MXX_PARTITION_HPP diff --git a/include/mxx/reduction.hpp b/include/mxx/reduction.hpp index c2407c5..b66b641 100644 --- a/include/mxx/reduction.hpp +++ b/include/mxx/reduction.hpp @@ -1,9 +1,23 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file reduction.hpp * @author Patrick Flick * @brief Reduction operations. - * - * TODO add Licence */ #ifndef MXX_REDUCTION_HPP diff --git a/include/mxx/samplesort.hpp b/include/mxx/samplesort.hpp index 7ae44c2..14fd53f 100644 --- a/include/mxx/samplesort.hpp +++ b/include/mxx/samplesort.hpp @@ -1,11 +1,22 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @file samplesort.hpp * @author Patrick Flick * @brief Implements parallel, MPI sample sort - * - * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. - * - * TODO add Licence */ #ifndef MXX_SAMPLESORT_HPP diff --git a/include/mxx/shift.hpp b/include/mxx/shift.hpp index a046918..d116416 100644 --- a/include/mxx/shift.hpp +++ b/include/mxx/shift.hpp @@ -1,11 +1,26 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @file shift.hpp * @author Patrick Flick * @brief MPI shift communication patterns (exchange of boundary elements). * - * Copyright (c) TODO - * - * TODO add Licence + * TODO: + * - [ ] shifting of strings + * - [ ] support shifting in more than 1 dimension using cartesian communicators */ #ifndef MXX_SHIFT_HPP diff --git a/include/mxx/sort.hpp b/include/mxx/sort.hpp index 4fca867..2da5b53 100644 --- a/include/mxx/sort.hpp +++ b/include/mxx/sort.hpp @@ -1,11 +1,30 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @file sort.hpp * @author Patrick Flick - * @brief Implements parallel sorting. - * - * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. + * @brief Implements the interface for parallel sorting. * - * TODO add Licence + * TODO: + * - [ ] fix stable sort + * - [ ] fix sort on non GCC compilers + * - [ ] radix sort + * - [ ] fix sorting of samples + * - [ ] implement and try out different parallel sorting algorithms + * - [ ] bitonic sort for single elemenet per processor */ #ifndef MXX_SORT_HPP diff --git a/include/mxx/timer.hpp b/include/mxx/timer.hpp index d1ddc3a..94aaaf1 100644 --- a/include/mxx/timer.hpp +++ b/include/mxx/timer.hpp @@ -1,11 +1,22 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @file timer.hpp * @author Patrick Flick * @brief MPI synchronized section timer. - * - * Copyright (c) TODO - * - * TODO add Licence */ #ifndef MXX_TIMER_HPP @@ -44,6 +55,7 @@ class timer_impl { } }; +/// mxx::timer: Specialization for measuring milliseconds in double precision using timer = timer_impl >; template @@ -108,6 +120,7 @@ class section_timer_impl { template int section_timer_impl::depth = 0; +/// mxx::section_timer: specialization for measuring milliseconds in double precision using section_timer = section_timer_impl >; } // namespace mxx diff --git a/include/mxx/utils.hpp b/include/mxx/utils.hpp index 1a5165b..3880d47 100644 --- a/include/mxx/utils.hpp +++ b/include/mxx/utils.hpp @@ -1,11 +1,22 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @file mpi_utils.hpp * @author Patrick Flick * @brief Implements some helpful MPI utility functions. - * - * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. - * - * TODO add Licence */ #ifndef MXX_UTILS_HPP #define MXX_UTILS_HPP diff --git a/include/old/collective_old.hpp b/include/old/collective_old.hpp index 386776a..69dd872 100644 --- a/include/old/collective_old.hpp +++ b/include/old/collective_old.hpp @@ -1,12 +1,28 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @file collective.hpp * @author Patrick Flick * @author Nagakishore Jammula * @brief Collective operations. * - * Copyright (c) TODO - * - * TODO add Licence + * This file contains wrappers for collective operations. These are prior + * to a rewrite and "standardization" of function calls for mxx collective + * operations. + * TODO: implement all these functions in new `mxx`, and then remove this file. */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 54ef4aa..fd84a00 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,9 +16,11 @@ target_link_libraries(test-scat mpi_gtest) add_executable(test-reductions test_reductions.cpp) target_link_libraries(test-reductions mpi_gtest) -# TODO: remove this one later add_executable(test-send test_send.cpp) -target_link_libraries(test-send ${EXTRA_LIBS}) +target_link_libraries(test-send mpi_gtest) + +add_executable(test-all test_scat.cpp test_reductions.cpp test_send.cpp) +target_link_libraries(test-all mpi_gtest) ################ # Old tests: # diff --git a/test/mpi_gtest.cpp b/test/mpi_gtest.cpp index fc75bcb..9af5e04 100644 --- a/test/mpi_gtest.cpp +++ b/test/mpi_gtest.cpp @@ -1,3 +1,25 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file mpi_gtest.cpp + * @author Patrick Flick + * @brief MPI enabled Google Test framework. Process 0 will collect + * the results (and failures) of all tests and output it. + */ #include #include #include diff --git a/test/reduce.cpp b/test/reduce.cpp index 178e997..3863d60 100644 --- a/test/reduce.cpp +++ b/test/reduce.cpp @@ -1,3 +1,21 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// some internal tests for reduction functions, not part of the official GTest test suite + #include #include #include diff --git a/test/test_bigall2all.cpp b/test/test_bigall2all.cpp index a02e92f..837b9aa 100644 --- a/test/test_bigall2all.cpp +++ b/test/test_bigall2all.cpp @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include #include diff --git a/test/test_file.cpp b/test/test_file.cpp index 9d0bedd..93ed849 100644 --- a/test/test_file.cpp +++ b/test/test_file.cpp @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include #include diff --git a/test/test_reductions.cpp b/test/test_reductions.cpp index ad261c9..a86b5b4 100644 --- a/test/test_reductions.cpp +++ b/test/test_reductions.cpp @@ -1,9 +1,23 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @file test_reductions.cpp * @author Patrick Flick * @brief GTest Unit Tests for mxx reductions - * - * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. */ #include diff --git a/test/test_scat.cpp b/test/test_scat.cpp index a7ba370..f7116f3 100644 --- a/test/test_scat.cpp +++ b/test/test_scat.cpp @@ -1,10 +1,23 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @file mpi_tests.cpp * @ingroup group * @author Patrick Flick - * @brief GTest Unit Tests for the parallel MPI code. - * - * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. + * @brief GTest Unit Tests for collective operations. */ #include diff --git a/test/test_scatter.cpp b/test/test_scatter.cpp index 6a843c5..457841a 100644 --- a/test/test_scatter.cpp +++ b/test/test_scatter.cpp @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include diff --git a/test/test_send.cpp b/test/test_send.cpp index 3207deb..884eda2 100644 --- a/test/test_send.cpp +++ b/test/test_send.cpp @@ -1,35 +1,38 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include -#include -#include +#include -struct Blah { - const int& x; -}; -Blah get(const int& x) { - Blah b{x}; - return b; -} - -int main(int argc, char *argv[]) -{ - // set up MPI - MPI_Init(&argc, &argv); +TEST(MxxComm, SendRecv1) { mxx::comm c; // send variable sized vector in cyclic order std::vector x(c.rank() + 1); + // receive from next mxx::future> fvec = c.irecv_vec(((c.rank()+1) % c.size())+1,(c.rank() + 1) % c.size()); + // send to previous c.isend(x, (c.rank() + (c.size()-1)) % c.size()); - std::cout << "On rank " << c.rank() << " got: " << fvec.get() << std::endl; + ASSERT_EQ((c.rank() + 1) % c.size() + 1u, fvec.get().size()); // send a string message in cyclic order between all processes in the communicator mxx::future fstr = c.irecv_str(12,(c.rank() + 1) % c.size()); c.send("Hello World!", (c.rank()+c.size()-1) % c.size()); - std::cout << "On rank " << c.rank() << " received: " << fstr.get() << std::endl; + std::string s = fstr.get(); + ASSERT_EQ(std::string("Hello World!"), s); - // finalize MPI - MPI_Finalize(); - return 0; } diff --git a/test/test_sort.cpp b/test/test_sort.cpp index 197defb..63fdb45 100644 --- a/test/test_sort.cpp +++ b/test/test_sort.cpp @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Georgia Institute of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include #include