| /petsc/include/petsc/private/cpp/ |
| H A D | type_traits.hpp | 15 using std::add_const_t; 16 using std::add_pointer_t; 17 using std::conditional_t; 18 using std::decay_t; 19 using std::enable_if_t; 20 using std::remove_const_t; 21 using std::remove_cv_t; 22 using std::remove_extent_t; 23 using std::remove_pointer_t; 24 using std::remove_reference_t; [all …]
|
| H A D | utility.hpp | 7 #include <cstdint> // std::uint32_t 16 using std::exchange; 17 using std::integer_sequence; 18 using std::make_integer_sequence; 23 T old_value = std::move(orig); 24 orig = std::forward<U>(new_value); 30 static_assert(std::is_integral<T>::value, ""); 34 static constexpr std::size_t size() noexcept { return sizeof...(idx); } 52 struct make_sequence : make_sequence<T, N - 1, T(N - 1), idx...> { }; 66 template <std::size_t... idx> [all …]
|
| H A D | unordered_map.hpp | 5 #pragma clang diagnostic ignored "-Wshorten-64-to-32" 9 #include <petsc/private/cpp/utility.hpp> // std ::pair 10 #include <petsc/private/cpp/functional.hpp> // std::hash, std::equal_to 21 #include <cstdint> // std::uint32_t 23 #include <iterator> // std::inserter 24 #include <limits> // std::numeric_limits 25 #include <algorithm> // std::fill 35 // KHashTable - The hash table implementation which underpins UnorderedMap (and possibly 39 // is possible to use -- without modification -- as a khash_unordered_set already. 47 // The hasher type, provides a std::size_t operator()(const Value&) to produce a hash of Value [all …]
|
| H A D | functional.hpp | 21 static decltype(std::declval<F>()(std::declval<A>()...), std::true_type()) f(int); 24 static std::false_type f(...); 36 template <std::size_t ix> 38 using type = util::tuple_element_t<ix, std::tuple<Args...>>; 42 // class-like operator() 47 template <std::size_t ix> 49 using type = util::tuple_element_t<ix, std::tuple<Args...>>; 57 template <std::size_t ix> 59 using type = util::tuple_element_t<ix, std::tuple<Args...>>; 76 template <std::size_t idx> [all …]
|
| H A D | memory.hpp | 19 using std::make_unique; 27 using unique_single = std::unique_ptr<T>; 32 using unique_array_unknown_bound = std::unique_ptr<T[]>; 35 template <class T, std::size_t N> 45 return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); 49 inline typename detail::unique_if<T>::unique_array_unknown_bound make_unique(std::size_t n) 51 return std::unique_ptr<T>(new util::remove_extent_t<T>[n]()); 59 // only use std::destroy_at from C++20 onwards (even though it was introduced in C++17) since 61 using std::destroy_at; 62 using std::construct_at; [all …]
|
| H A D | object_pool.hpp | 7 #include <petsc/private/cpp/utility.hpp> // util::exchange(), std::pair 9 #include <petsc/private/cpp/memory.hpp> // std::align(), std::unique_ptr 11 #include <cstddef> // std::size_t 12 #include <vector> // std::take_a_wild_guess 20 enum class align_val_t : std::size_t { 27 namespace std namespace 40 } // namespace std 62 using size_type = std::size_t; 64 …using pool_type = std::vector<std::pair<align_type, UnorderedMap<size_type, std::vector<void *>>>… 94 explicit LockGuard(PoolAllocator *pool) noexcept : pool_{pool} { ++pool_->locked_; } in LockGuard() [all …]
|
| /petsc/src/sys/tests/ |
| H A D | ex64.cxx | 6 #include <sstream> // std::ostringstream 9 #include <algorithm> // std::sort 15 // see https://stackoverflow.com/questions/2590677/how-do-i-combine-hash-values-in-c0x 16 static inline void hash_combine(std::size_t &) noexcept { } in hash_combine() 19 static inline void hash_combine(std::size_t &seed, const T &v, Rest &&...rest) noexcept in hash_combine() 21 std::hash<T> hasher; in hash_combine() 23 hash_combine(seed, std::forward<Rest>(rest)...); in hash_combine() 27 namespace std \ 31 std::size_t operator()(const type &t) const noexcept \ 33 std::size_t ret = 0; \ [all …]
|
| H A D | ex45.cxx | 16 if (comm->getRank() == 0) { in exampleRoutine() 18 std::cout << Tpetra::version() << std::endl << std::endl; in exampleRoutine() 27 // things like std::endl or Teuchos::RCP. in main() 28 using std::cout; in main() 29 using std::endl; in main() 37 argc, argv - These command line arguments are taken to extract the options in main() 39 help - When PETSc executable is invoked with the option -help, in main() 49 const int myRank = comm->getRank(); in main() 50 const int size = comm->getSize(); in main() 68 filter: grep -v "Tpetra in Trilinos"
|
| H A D | ex46.cxx | 17 if (comm->getRank() == 0) { in exampleRoutine() 19 std::cout << Tpetra::version() << std::endl << std::endl; in exampleRoutine() 28 // things like std::endl. in main() 29 using std::cout; in main() 30 using std::endl; in main() 36 // address of an std::ostream, it will print a one-line status in main() 60 const int myRank = comm->getRank(); in main() 61 const int size = comm->getSize(); in main() 81 filter: grep -v "Tpetra in Trilinos"
|
| /petsc/src/mat/tests/ |
| H A D | ex231.cxx | 10 Contributed-by: Fande Kong <fdkong.jd@gmail.com>, John Peterson <jwpeterson@gmail.com> 40 PetscCall(PetscOptionsGetString(NULL, NULL, "-f0", file[0], sizeof(file[0]), &flg)); in main() 41 …lg, PETSC_COMM_WORLD, PETSC_ERR_USER, "Must indicate dof indices file for rank 0 with -f0 option"); in main() 43 PetscCall(PetscOptionsGetString(NULL, NULL, "-f1", file[1], sizeof(file[1]), &flg)); in main() 44 …lg, PETSC_COMM_WORLD, PETSC_ERR_USER, "Must indicate dof indices file for rank 1 with -f1 option"); in main() 61 std::vector<std::vector<std::vector<PetscInt>>> elem_dof_indices(size); in main() 63 std::string line; in main() 64 std::ifstream dof_file(file[proc_id]); in main() 66 while (std::getline(dof_file, line)) { in main() 67 std::vector<PetscInt> dof_indices; in main() [all …]
|
| /petsc/include/ |
| H A D | petsccxxcomplexfix.h | 7 In particular, it silences `-Wfloat-equal` warnings in `operator==()` and `operator!=` below. 18 std::complex<double> c = 22.0; 23 error: no match for 'operator+' (operand types are 'int' and 'std::complex<double>') 27 std::complex<float> c = 22.0; 32 error: no match for 'operator+' (operand types are 'double' and 'std::complex<float>') 47 // For operations "Atype op Cmplex" or "Cmplex op Atype" with Cmplex being PetscComplex, the built-… 53 …std::integral_constant<bool, (std::is_same<Cmplex, PetscComplex>::value && std::is_arithmetic<Atyp… 55 || std::is_same<Atype, __fp16>::value 58 || std::is_same<Atype, __float128>::value 64 inline typename std::enable_if<petsccomplex_extended_type<Cmplex, Atype>::value, Cmplex>::type oper… [all …]
|
| /petsc/src/ksp/pc/impls/amgx/ |
| H A D | amgx.cxx | 7 pcimpl.h - private include file intended for use by all preconditioners 59 static const std::map<std::string, AmgXAMGMethod> AMGMethods; 60 static const std::map<std::string, AmgXSmoother> Smoothers; 61 static const std::map<std::string, AmgXSelector> Selectors; 62 static const std::map<std::string, AmgXCoarseSolver> CoarseSolvers; 63 static const std::map<std::string, AmgXAMGCycle> AMGCycles; 66 const std::map<std::string, AmgXAMGMethod> AmgXControlMap::AMGMethods = { 71 const std::map<std::string, AmgXSmoother> AmgXControlMap::Smoothers = { 87 const std::map<std::string, AmgXSelector> AmgXControlMap::Selectors = { 96 const std::map<std::string, AmgXCoarseSolver> AmgXControlMap::CoarseSolvers = { [all …]
|
| /petsc/include/petsc/private/ |
| H A D | cupminterface.hpp | 26 // clang-format off 27 static constexpr std::array<const char *const, 5> DeviceTypes = { 34 // clang-format on 54 // PETSC_CUPM_ALIAS_FUNCTION() - declaration to alias a cuda/hip function 57 // our_name - the name of the alias 58 // their_name - the name of the function being aliased 64 // PETSC_CUPM_ALIAS_FUNCTION(cupmMalloc, cudaMalloc) -> 68 // return cudaMalloc(std::forward<T>(args)...); 71 // PETSC_CUPM_ALIAS_FUNCTION(cupmMalloc, hipMalloc) -> 75 // return hipMalloc(std::forward<T>(args)...); [all …]
|
| /petsc/src/sys/objects/device/tests/ |
| H A D | ex11.cxx | 9 #include <cstdarg> // std::va_list 10 #include <vector> // std:vector 11 #include <unordered_map> // std::take_a_wild_guess 12 #include <algorithm> // std::find 13 #include <iterator> // std::distance, std::next 30 PetscCall(PetscDeviceContextMarkIntentFromID(dctx, id, this->mode, name)); in operator ()() 40 …ObjectMapView(PetscViewer vwr, std::size_t nkeys, const PetscObjectId *keys, const PetscMemoryAcce… in MarkedObjectMapView() 51 for (std::size_t i = 0; i < nkeys; ++i) { in MarkedObjectMapView() 52 PetscCall(PetscViewerASCIISynchronizedPrintf(vwr, "id %" PetscInt64_FMT " -> {\n", keys[i])); in MarkedObjectMapView() 57 for (std::size_t j = 0; j < ndeps[i]; ++j) { in MarkedObjectMapView() [all …]
|
| /petsc/src/sys/objects/device/impls/ |
| H A D | impldevicebase.hpp | 11 #include <cstring> // for std::strlen 49 …ode PetscOptionDeviceAll(MPI_Comm, std::pair<PetscDeviceInitType, PetscBool> &, std::pair<PetscInt… 53 …ptionDeviceBasic(PetscOptionItems, std::pair<PetscDeviceInitType, PetscBool> &, std::pair<PetscInt… 56 // - A simple form returning only the value and flag. This gives no control over the message, 58 // - A complex form, which allows you to pass most of the options query arguments *EXCEPT* 59 // - The options query function called 60 // - The option string 97 PetscCall(this->underlying().init_device_id_(&id)); in getDevice() 98 device->deviceId = id; in getDevice() 99 device->ops->createcontext = this->underlying().create_; in getDevice() [all …]
|
| H A D | segmentedmempool.hpp | 38 return static_cast<const T &>(*this).record_event_(std::forward<E>(event)); in record_event() 44 return static_cast<const T &>(*this).wait_for_(std::forward<E>(event)); in wait_for_event() 51 using default_stream_type = std::nullptr_t; 71 const typename StreamBase<T>::id_type StreamBase<T>::INVALID_ID = -1; 90 // Represents a checked-out region of a MemoryBlock. Tracks the offset into the owning 98 using size_type = std::size_t; 138 // MemoryChunk - Private API 146 return (stream_id_ == strm->INVALID_ID) || (stream_id_ == strm->get_id()); in stream_compat_() 150 // MemoryChunk - Public API 165 …std::move(other.event_)), open_(util::exchange(other.open_, false)), stream_id_(util::exchange(oth… in MemoryChunk() [all …]
|
| /petsc/src/sys/objects/device/interface/ |
| H A D | petscdevice_interface_internal.hpp | 5 #include <petsc/private/cpp/utility.hpp> // std::pair 6 #include <petsc/private/cpp/memory.hpp> // std::weak_ptr, std::shared_ptr 9 #include <algorithm> // std::lower_bound 14 // unordered_set for clang and hand-rolled flat set for GCC... 45 using weak_ptr_type = std::weak_ptr<_p_PetscDeviceContext>; 51 using std::swap; in swap() 71 …t _n_WeakContext(const std::shared_ptr<_p_PetscDeviceContext> &ptr) noexcept : weak_dctx_{ptr}, st… in _n_WeakContext() 80 using upstream_type = std::unordered_map<PetscObjectId, _n_WeakContext>; 82 using marked_type = std::unordered_set<PetscObjectId>; 84 using marked_type = std::vector<PetscObjectId>; [all …]
|
| H A D | mark_dcontext.cxx | 7 #include <algorithm> // std::remove_if(), std::find_if() 10 #include <sstream> // std::ostringstream 13 PETSC_PRAGMA_DIAGNOSTIC_IGNORED_BEGIN("-Wgnu-zero-variadic-macro-arguments") 40 if (auto &destroy = event->destroy) { in reset_() 44 …PetscAssert(!event->data, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Event failed to destroy its data membe… in reset_() 45 event->dctx_id = 0; in reset_() 46 event->dctx_state = 0; in reset_() 47 event->dtype = PETSC_DEVICE_DEFAULT(); in reset_() 62 PetscCall(PetscDeviceContextGetDeviceType(dctx, &(*event)->dtype)); in PetscDeviceContextCreateEvent_Private() 83 id = PetscObjectCast(dctx)->id; in PetscDeviceContextRecordEvent_Private() [all …]
|
| H A D | memory.cxx | 7 #include <algorithm> // std::find_if 8 #include <cstring> // std::memset 31 // GCC implementation for std::hash<T*>. LLVM's libc++ is almost 2x slower because they do all 35 PETSC_NODISCARD std::size_t operator()(const T *ptr) const noexcept in operator ()() 37 return reinterpret_cast<std::size_t>(ptr); in operator ()() 50 std::size_t size = 0; // size of allocation (bytes) 55 constexpr PointerAttributes(PetscMemType, PetscObjectId, std::size_t) noexcept; 63 // PointerAttributes - Public API 66 inline constexpr PointerAttributes::PointerAttributes(PetscMemType mtype_, PetscObjectId id_, std::… in PointerAttributes() 74 PointerAttributes::contains - asks and answers the question, does ptr_begin contain ptr [all …]
|
| /petsc/src/dm/impls/moab/tests/ |
| H A D | ex1.cxx | 6 #pragma GCC diagnostic ignored "-Wunused-result" 27 PetscCall(PetscStrncpy(options->filename, "", sizeof(options->filename))); in ProcessOptions() 28 PetscCall(PetscStrncpy(options->tagname, "petsc_tag", sizeof(options->tagname))); in ProcessOptions() 29 options->dim = -1; in ProcessOptions() 32 …PetscCall(PetscOptionsRangeInt("-dim", "The topological mesh dimension", "ex1.cxx", options->dim, … in ProcessOptions() 33 …l(PetscOptionsString("-filename", "The file containing the mesh", "ex1.cxx", options->filename, op… in ProcessOptions() 34 …scOptionsString("-tagname", "The tag name from which to create a vector", "ex1.cxx", options->tagn… in ProcessOptions() 37 PetscCall(PetscLogEventRegister("CreateMesh", DM_CLASSID, &options->createMeshEvent)); in ProcessOptions() 51 PetscCall(PetscLogEventBegin(user->createMeshEvent, 0, 0, 0, 0)); in CreateMesh() 53 std::cout << "Created DMMoab using DMMoabCreateMoab." << std::endl; in CreateMesh() [all …]
|
| /petsc/src/ksp/ksp/tests/ |
| H A D | ex63.cxx | 7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 93 size_t myRank = comm->getRank(); in main() 95 RCP<Teuchos::FancyOStream> fos = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); in main() 97 *fos << Amesos2::version() << std::endl << std::endl; in main() 105 std::string solver_name; in main() 106 std::string filedir; in main() 107 std::string filename; in main() 111 cmdp.setOption("filedir", &filedir, "Directory where matrix-market files are located"); in main() 112 cmdp.setOption("filename", &filename, "Filename for Matrix-Market test matrix."); in main() 113 …cmdp.setOption("print-matrix", "no-print-matrix", &printMatrix, "Print the full matrix after readi… in main() [all …]
|
| /petsc/src/vec/vec/impls/seq/kokkos/ |
| H A D | veckokkosimpl.hpp | 11 …os, PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Calling VECKOKKOS methods on a non-VECKOKKOS object"); \ 27 …PetscCountKokkosView jmap1_d; /* [m+1]: i-th entry of the vector has jmap1[i+1]-jmap1[i] repeats i… 30 …PetscCountKokkosView imap2_d; /* [nnz2]: i-th unique entry in recvbuf is imap2[i]-th… 66 …typename MemorySpace, std::enable_if_t<std::is_same<MemorySpace, HostMirrorMemorySpace>::value, bo… 73 …/* Kokkos said they would add error-checking so that users won't accidentally pass two different V… in UpdateArray() 78 …typename MemorySpace, std::enable_if_t<std::is_same<MemorySpace, HostMirrorMemorySpace>::value, bo… 89 …typename MemorySpace, std::enable_if_t<!std::is_same<MemorySpace, HostMirrorMemorySpace>::value, b… 103 …create_mirror_view_and_copy(DefaultMemorySpace(), PetscCountKokkosViewHost(vecseq->jmap1, m + 1))); in SetUpCOO() 104 …mirror_view_and_copy(DefaultMemorySpace(), PetscCountKokkosViewHost(vecseq->perm1, vecseq->tot1))); in SetUpCOO() 111 …create_mirror_view_and_copy(DefaultMemorySpace(), PetscCountKokkosViewHost(vecmpi->jmap1, m + 1))); in SetUpCOO() [all …]
|
| /petsc/src/sys/objects/device/impls/cupm/ |
| H A D | cupmevent.hpp | 19 // destroy, they are not free. Using the pool vs on-demand creation and destruction yields a ~20% 32 std::stack<cupmEvent_t> pool_; 40 PetscCallCUPM(cupmEventDestroy(std::move(pool_.top()))); in finalize_() 52 PetscCall(this->register_finalize()); in allocate() 55 PetscCallCXX(*event = std::move(pool_.top())); in allocate() 66 if (auto event = std::exchange(*in_event, cupmEvent_t{})) { in deallocate() 67 if (this->registered()) { in deallocate() 68 PetscCallCXX(pool_.push(std::move(event))); in deallocate() 85 inline auto cupm_fast_event_pool() noexcept -> decltype(cupm_event_pool<T, impl::Interface<T>::cupm… in cupm_fast_event_pool() 92 inline auto cupm_timer_event_pool() noexcept -> decltype(cupm_event_pool<T, impl::Interface<T>::cup… in cupm_timer_event_pool() [all …]
|
| /petsc/src/ksp/pc/impls/hpddm/ |
| H A D | pchpddm.cxx | 9 static PetscErrorCode (*loadedSym)(HPDDM::Schwarz<PetscScalar> *const, IS, Mat, Mat, Mat, std::vect… 25 PC_HPDDM *data = (PC_HPDDM *)pc->data; in PCReset_HPDDM() 28 if (data->levels) { in PCReset_HPDDM() 29 for (PetscInt i = 0; i < PETSC_PCHPDDM_MAXLEVELS && data->levels[i]; ++i) { in PCReset_HPDDM() 30 PetscCall(KSPDestroy(&data->levels[i]->ksp)); in PCReset_HPDDM() 31 PetscCall(PCDestroy(&data->levels[i]->pc)); in PCReset_HPDDM() 32 PetscCall(PetscFree(data->levels[i])); in PCReset_HPDDM() 34 PetscCall(PetscFree(data->levels)); in PCReset_HPDDM() 36 PetscCall(ISDestroy(&data->is)); in PCReset_HPDDM() 37 PetscCall(MatDestroy(&data->aux)); in PCReset_HPDDM() [all …]
|
| /petsc/src/dm/impls/moab/ |
| H A D | dmmbmg.cxx | 7 static inline std::vector<PetscScalar> VecReal_to_VecScalar(const std::vector<PetscReal> &v) in VecReal_to_VecScalar() 9 std::vector<PetscScalar> res(v.size()); in VecReal_to_VecScalar() 15 DMMoabGenerateHierarchy - Generate a multi-level uniform refinement hierarchy 22 . dm - The `DMMOAB` object 25 + nlevels - The number of levels of refinement needed to generate the hierarchy 26 - ldegrees - The degree of refinement at each level in the hierarchy 37 std::vector<moab::EntityHandle> hsets; in DMMoabGenerateHierarchy() 41 dmmoab = (DM_Moab *)dm->data; in DMMoabGenerateHierarchy() 49 dmmoab->nhlevels = nlevels; in DMMoabGenerateHierarchy() 53 …dmmoab->hierarchy = new moab::NestedRefine(dynamic_cast<moab::Core *>(dmmoab->mbiface), dmmoab->pc… in DMMoabGenerateHierarchy() [all …]
|