Skip to content

Commit c634187

Browse files
committed
Merge branch 'master' into woptim/spack-update
2 parents b594fed + c101dca commit c634187

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+708
-507
lines changed

include/caliper/Caliper.h

+32-17
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,21 @@ typedef std::function<void(CaliperMetadataAccessInterface&,const std::vector<cal
4040
class Channel
4141
{
4242
struct ChannelImpl;
43-
4443
std::shared_ptr<ChannelImpl> mP;
4544

4645
Channel(cali_id_t id, const char* name, const RuntimeConfig& cfg);
4746

4847
public:
4948

49+
constexpr Channel()
50+
: mP { nullptr } { }
51+
52+
Channel(const Channel&) = default;
53+
Channel(Channel&&) = default;
54+
55+
Channel& operator = (const Channel&) = default;
56+
Channel& operator = (Channel&&) = default;
57+
5058
~Channel();
5159

5260
// --- Events (callback functions)
@@ -175,9 +183,22 @@ class Channel
175183

176184
cali_id_t id() const;
177185

186+
operator bool() const { return mP.use_count() > 0; }
187+
178188
friend class Caliper;
189+
friend bool operator == (const Channel&, const Channel&);
190+
friend bool operator != (const Channel&, const Channel&);
179191
};
180192

193+
inline bool operator == (const Channel& a, const Channel& b)
194+
{
195+
return a.mP == b.mP;
196+
}
197+
198+
inline bool operator != (const Channel& a, const Channel& b)
199+
{
200+
return a.mP != b.mP;
201+
}
181202

182203
/// \class Caliper
183204
/// \brief The main interface for the caliper runtime system
@@ -493,7 +514,7 @@ class Caliper : public CaliperMetadataAccessInterface
493514
/// \brief Return all global attributes for \a channel
494515
///
495516
///
496-
std::vector<Entry> get_globals(Channel* channel);
517+
std::vector<Entry> get_globals(const Channel& channel);
497518

498519
/// \}
499520
/// \name Explicit snapshot record manipulation
@@ -630,38 +651,32 @@ class Caliper : public CaliperMetadataAccessInterface
630651
/// \param name Name of the channel. This is used to identify the channel
631652
/// in %Caliper log output.
632653
/// \param cfg The channel's runtime configuration.
633-
/// \return Pointer to the channel. Null pointer if the channel could
634-
/// not be created.
635-
Channel* create_channel(const char* name, const RuntimeConfig& cfg);
654+
/// \return The channel
655+
Channel create_channel(const char* name, const RuntimeConfig& cfg);
636656

637657
/// \brief Return all existing channels
638-
std::vector<Channel*> get_all_channels();
658+
std::vector<Channel> get_all_channels();
639659

640-
/// \brief Return pointer to channel object with the given ID.
641-
///
642-
/// The call returns a pointer to the created channel object. %Caliper
643-
/// retains ownership of the channel object. This pointer becomes invalid
644-
/// when the channel is deleted. %Caliper notifies users with the
645-
/// finish_evt callback when an channel is about to be deleted.
646-
Channel* get_channel(cali_id_t id);
660+
/// \brief Return the channel with the given ID or an empty Channel object.
661+
Channel get_channel(cali_id_t id);
647662

648663
/// \brief Delete the given channel.
649664
///
650665
/// Deleting channels is \b not thread-safe.
651-
void delete_channel(Channel* chn);
666+
void delete_channel(Channel& chn);
652667

653668
/// \brief Activate the given channel.
654669
///
655670
/// Inactive channels will not track or process annotations and other
656671
/// blackboard updates.
657-
void activate_channel(Channel* chn);
672+
void activate_channel(Channel& chn);
658673

659674
/// \brief Deactivate the given channel.
660675
/// \copydetails Caliper::activate_channel
661-
void deactivate_channel(Channel* chn);
676+
void deactivate_channel(Channel& chn);
662677

663678
/// \brief Flush and delete all channels
664-
void finalize();
679+
void finalize();
665680

666681
/// \}
667682

include/caliper/ChannelController.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ class ChannelController
5252

5353
/// \brief Create the channel with the controller's
5454
/// name, flags, and config map
55-
Channel* create();
55+
Channel create();
5656

5757
/// \brief Callback function, invoked after the underlying channel
5858
/// has been created.
5959
///
6060
/// This can be used to setup additional functionality, e.g.
6161
/// registering %Caliper callbacks.
62-
virtual void on_create(Caliper* /*c*/, Channel* /*chn*/) { }
62+
virtual void on_create(Caliper* /*c*/, Channel& /*chn*/) { }
6363

6464
public:
6565

6666
/// \brief Return the underlying %Caliper channel object.
67-
Channel* channel();
67+
Channel channel();
6868

6969
/// \brief Create and activate the %Caliper channel,
7070
/// or reactivate a stopped %Caliper channel.

scripts/run-annotation-perftest.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/bin/bash
22

3-
depth=20
3+
depth=28
44
width=200
55

66
EXE=`pwd`/test/cali-annotation-perftest
77
ARGS="-d ${depth} -w ${width}"
88

9-
# Run Caliper annotation benchmarks. Designed to run on LLNL quartz (36 cores/node)
9+
# Run Caliper annotation benchmarks. Designed to run on LLNL dane (56 cores/socket)
1010

11-
for threads in 1 4 36
11+
for threads in 1 4 56
1212
do
1313
# Annotations only, no active measurement config
1414
OMP_NUM_THREADS=${threads} \

0 commit comments

Comments
 (0)