Skip to content

Commit

Permalink
Fixing unbound variable error
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Nov 25, 2024
1 parent ae30ab7 commit b15031a
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos_debug_fetch_hwloc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install dependencies
run: |
brew install --overwrite python-tk && \
brew install --overwrite boost gperftools ninja autoconf automake && \
brew install --overwrite boost gperftools ninja autoconf automake libtool && \
autoreconf -f -i \
brew upgrade cmake
- name: Configure
Expand Down
3 changes: 3 additions & 0 deletions .jenkins/lsu/env-clang-17.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ module load openmpi
export HPXRUN_RUNWRAPPER=srun
export CXX_STD="20"
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
if [[ ! -v CXXFLAGS ]]; then
export CXXFLAGS=""
fi
export CXXFLAGS="-fopenmp -Wno-pass-failed ${CXXFLAGS}"

configure_extra_options+=" -DCMAKE_BUILD_TYPE=${build_type}"
Expand Down
3 changes: 3 additions & 0 deletions .jenkins/lsu/env-gcc-13.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ module load openmpi
export HPXRUN_RUNWRAPPER=srun
export CXX_STD="20"
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
if [[ ! -v CXXFLAGS ]];
then export CXXFLAGS=""
fi
export CXXFLAGS="-fopenmp ${CXXFLAGS}"

configure_extra_options+=" -DHPX_WITH_CXX_STANDARD=${CXX_STD}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ namespace hpx::server {
/// size 0.
partitioned_vector();

explicit partitioned_vector(std::size_t partnum,
std::vector<size_type> const& partition_sizes,
traits::create_mode = traits::create_mode::resize);
explicit partitioned_vector(
std::size_t partnum, std::vector<size_type> const& partition_sizes);

/// Constructor which create and initialize partitioned_vector_partition
/// with all elements as \a val.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,10 @@ namespace hpx::server {

template <typename T, typename Data>
HPX_PARTITIONED_VECTOR_SPECIALIZATION_EXPORT
partitioned_vector<T, Data>::partitioned_vector(std::size_t partnum,
std::vector<size_type> const& partition_sizes, traits::create_mode mode)
partitioned_vector<T, Data>::partitioned_vector(
std::size_t partnum, std::vector<size_type> const& partition_sizes)
{
if (mode == traits::create_mode::resize)
{
partitioned_vector_partition_.resize(partition_sizes[partnum]);
}
else
{
partitioned_vector_partition_.reserve(partition_sizes[partnum]);
}
partitioned_vector_partition_.resize(partition_sizes[partnum]);
}

template <typename T, typename Data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ namespace hpx {
using partitioned_vector_partition_client =
hpx::partitioned_vector_partition<T, Data>;

using create_mode = traits::create_mode;

struct partition_data
: server::partitioned_vector_config_data::partition_data
{
Expand Down Expand Up @@ -333,7 +331,7 @@ namespace hpx {
template <typename DistPolicy>
static hpx::future<std::vector<bulk_locality_result>> create_helper1(
DistPolicy const& policy, std::size_t count,
std::vector<std::size_t> const& sizes, create_mode mode);
std::vector<std::size_t> const& sizes);

template <typename DistPolicy>
static hpx::future<std::vector<bulk_locality_result>> create_helper2(
Expand All @@ -343,8 +341,7 @@ namespace hpx {
// This function is called when we are creating the vector. It
// initializes the partitions based on the give parameters.
template <typename DistPolicy, typename Create>
void create(DistPolicy const& policy, Create&& creator,
create_mode mode = create_mode::resize);
void create(DistPolicy const& policy, Create&& creator);

template <typename DistPolicy>
void create(DistPolicy const& policy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,12 @@ namespace hpx {
HPX_PARTITIONED_VECTOR_SPECIALIZATION_EXPORT hpx::future<
std::vector<typename partitioned_vector<T, Data>::bulk_locality_result>>
partitioned_vector<T, Data>::create_helper1(DistPolicy const& policy,
std::size_t count, std::vector<std::size_t> const& sizes,
create_mode mode)
std::size_t count, std::vector<std::size_t> const& sizes)
{
using component_type =
typename partitioned_vector_partition_client::server_component_type;

return policy.template bulk_create<true, component_type>(
count, sizes, mode);
return policy.template bulk_create<true, component_type>(count, sizes);
}

template <typename T, typename Data /*= std::vector<T> */>
Expand All @@ -344,7 +342,7 @@ namespace hpx {
template <typename T, typename Data /*= std::vector<T> */>
template <typename DistPolicy, typename Create>
void partitioned_vector<T, Data>::create(
DistPolicy const& policy, Create&& creator, create_mode mode)
DistPolicy const& policy, Create&& creator)
{
std::size_t num_parts =
traits::num_container_partitions<DistPolicy>::call(policy);
Expand All @@ -353,7 +351,7 @@ namespace hpx {

// create as many partitions as required
hpx::future<std::vector<bulk_locality_result>> f =
HPX_FORWARD(Create, creator)(policy, num_parts, part_sizes, mode);
HPX_FORWARD(Create, creator)(policy, num_parts, part_sizes);

// now initialize our data structures
std::uint32_t const this_locality = get_locality_id();
Expand Down Expand Up @@ -413,8 +411,7 @@ namespace hpx {
HPX_PARTITIONED_VECTOR_SPECIALIZATION_EXPORT void
partitioned_vector<T, Data>::create(DistPolicy const& policy)
{
create(policy, &partitioned_vector::create_helper1<DistPolicy>,
traits::allocation_mode<DistPolicy>::call(policy));
create(policy, &partitioned_vector::create_helper1<DistPolicy>);
}

template <typename T, typename Data /*= std::vector<T> */>
Expand All @@ -424,7 +421,7 @@ namespace hpx {
{
create(policy,
[&val](DistPolicy const& policy, std::size_t num_parts,
std::vector<std::size_t> const& part_sizes, create_mode) {
std::vector<std::size_t> const& part_sizes) {
return create_helper2(policy, num_parts, part_sizes, val);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,4 @@ namespace hpx::traits {
num_parts, (size + num_parts - 1) / num_parts);
}
};

// By default, the container distribution policy resizes the underlying
// vectors.
enum class create_mode : std::uint8_t
{
resize = 0,
reserve = 1
};

template <typename Policy, typename Enable = void>
struct allocation_mode
{
static create_mode call(Policy const&)
{
return create_mode::resize;
}
};
} // namespace hpx::traits
Original file line number Diff line number Diff line change
Expand Up @@ -33,57 +33,48 @@ namespace hpx {
{
container_distribution_policy() = default;

container_distribution_policy operator()(std::size_t num_partitions,
traits::create_mode mode = traits::create_mode::resize) const
{
return {num_partitions, get_localities(), mode};
}

container_distribution_policy operator()(traits::create_mode mode) const
container_distribution_policy operator()(
std::size_t num_partitions) const
{
return container_distribution_policy(mode);
return {num_partitions, get_localities()};
}

container_distribution_policy operator()(hpx::id_type const& locality,
traits::create_mode mode = traits::create_mode::resize) const
container_distribution_policy operator()(
hpx::id_type const& locality) const
{
return {locality, mode};
return {locality};
}

container_distribution_policy operator()(
std::vector<id_type> const& localities,
traits::create_mode mode = traits::create_mode::resize) const
std::vector<id_type> const& localities) const
{
if (num_partitions_ != static_cast<std::size_t>(-1))
{
return {num_partitions_, localities, mode};
return {num_partitions_, localities};
}
return {localities.size(), localities, mode};
return {localities.size(), localities};
}

container_distribution_policy operator()(
std::vector<id_type>&& localities,
traits::create_mode mode = traits::create_mode::resize) const
std::vector<id_type>&& localities) const
{
if (num_partitions_ != static_cast<std::size_t>(-1))
{
return {num_partitions_, HPX_MOVE(localities), mode};
return {num_partitions_, HPX_MOVE(localities)};
}
return {localities.size(), HPX_MOVE(localities), mode};
return {localities.size(), HPX_MOVE(localities)};
}

container_distribution_policy operator()(std::size_t num_partitions,
std::vector<id_type> const& localities,
traits::create_mode mode = traits::create_mode::resize) const
std::vector<id_type> const& localities) const
{
return {num_partitions, localities, mode};
return {num_partitions, localities};
}

container_distribution_policy operator()(std::size_t num_partitions,
std::vector<id_type>&& localities,
traits::create_mode mode = traits::create_mode::resize) const
container_distribution_policy operator()(
std::size_t num_partitions, std::vector<id_type>&& localities) const
{
return {num_partitions, HPX_MOVE(localities), mode};
return {num_partitions, HPX_MOVE(localities)};
}

///////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -113,53 +104,38 @@ namespace hpx {
return *localities_;
}

[[nodiscard]] constexpr traits::create_mode get_create_mode() const
{
return mode_;
}

private:
friend class hpx::serialization::access;

template <typename Archive>
void serialize(Archive& ar, const unsigned int /* version */)
{
// clang-format off
ar & localities_ & num_partitions_ & mode_;
ar & localities_ & num_partitions_;
// clang-format on
}

container_distribution_policy(std::size_t num_partitions,
std::vector<id_type> const& localities, traits::create_mode mode)
container_distribution_policy(
std::size_t num_partitions, std::vector<id_type> const& localities)
: components::default_distribution_policy(localities)
, num_partitions_(num_partitions)
, mode_(mode)
{
}

container_distribution_policy(std::size_t num_partitions,
std::vector<id_type>&& localities, traits::create_mode mode)
container_distribution_policy(
std::size_t num_partitions, std::vector<id_type>&& localities)
: components::default_distribution_policy(HPX_MOVE(localities))
, num_partitions_(num_partitions)
, mode_(mode)
{
}

container_distribution_policy(
hpx::id_type const& locality, traits::create_mode mode)
container_distribution_policy(hpx::id_type const& locality)
: components::default_distribution_policy(locality)
, mode_(mode)
{
}

explicit container_distribution_policy(traits::create_mode mode)
: mode_(mode)
{
}

// number of chunks to create
std::size_t num_partitions_ = static_cast<std::size_t>(-1);
traits::create_mode mode_ = traits::create_mode::resize;
};

static container_distribution_policy const container_layout{};
Expand All @@ -181,14 +157,5 @@ namespace hpx {
return policy.get_num_partitions();
}
};

template <>
struct allocation_mode<container_distribution_policy>
{
static create_mode call(container_distribution_policy const& policy)
{
return policy.get_create_mode();
}
};
} // namespace traits
} // namespace hpx
Loading

0 comments on commit b15031a

Please sign in to comment.