Skip to content

Commit 21d7d4c

Browse files
committed
clang: Add clang format file
Lets start with this version of the file and see if the changes to nixl agent and a ucx header are okay. Signed-off-by: Adit Ranadive <[email protected]>
1 parent 9f00c7c commit 21d7d4c

File tree

4 files changed

+694
-698
lines changed

4 files changed

+694
-698
lines changed

.clang-format

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
AccessModifierOffset: -4
3+
AlignAfterOpenBracket: DontAlign
4+
AlignConsecutiveAssignments: false
5+
AlignConsecutiveDeclarations: false
6+
AlignEscapedNewlines: Left
7+
AlignOperands: DontAlign
8+
AlignTrailingComments: false
9+
AllowAllParametersOfDeclarationOnNextLine: false
10+
AllowShortBlocksOnASingleLine: true
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: Inline
13+
AllowShortIfStatementsOnASingleLine: true
14+
AllowShortLoopsOnASingleLine: false
15+
AlwaysBreakAfterDefinitionReturnType: None
16+
AlwaysBreakAfterReturnType: None
17+
AlwaysBreakBeforeMultilineStrings: false
18+
AlwaysBreakTemplateDeclarations: false
19+
BinPackArguments: false
20+
BinPackParameters: false
21+
BraceWrapping:
22+
AfterClass: false
23+
AfterControlStatement: false
24+
AfterEnum: false
25+
AfterFunction: true
26+
AfterNamespace: true
27+
AfterObjCDeclaration: false
28+
AfterStruct: false
29+
AfterUnion: false
30+
AfterExternBlock: false
31+
BeforeCatch: true
32+
BeforeElse: false
33+
IndentBraces: false
34+
BreakBeforeBinaryOperators: None
35+
BreakBeforeBraces: Linux
36+
BreakBeforeInheritanceComma: false
37+
BreakBeforeTernaryOperators: false
38+
BreakConstructorInitializers: AfterColon
39+
BreakStringLiterals: true
40+
ColumnLimit: 100
41+
CompactNamespaces: false
42+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
43+
ConstructorInitializerIndentWidth: 8
44+
ContinuationIndentWidth: 8
45+
DerivePointerAlignment: false
46+
IndentCaseLabels: true
47+
IndentPPDirectives: None
48+
IndentWidth: 4
49+
IndentWrappedFunctionNames: false
50+
MaxEmptyLinesToKeep: 2
51+
NamespaceIndentation: All
52+
53+
PointerAlignment: Right
54+
ReflowComments: true
55+
SortIncludes: false
56+
SortUsingDeclarations: false
57+
SpaceAfterCStyleCast: false
58+
SpaceAfterTemplateKeyword: true
59+
SpaceBeforeAssignmentOperators: true
60+
SpaceBeforeCtorInitializerColon: true
61+
SpaceBeforeInheritanceColon: true
62+
SpaceBeforeParens: ControlStatements
63+
SpaceBeforeRangeBasedForLoopColon: true
64+
SpaceInEmptyParentheses: false
65+
SpacesBeforeTrailingComments: 1
66+
SpacesInAngles: false
67+
SpacesInContainerLiterals: false
68+
SpacesInSquareBrackets: false
69+
TabWidth: 4
70+
UseTab: Never
71+
...

src/core/agent_data.h

Lines changed: 68 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,18 @@
2525
#if HAVE_ETCD
2626
#include <etcd/Client.hpp>
2727

28-
namespace etcd {
28+
namespace etcd
29+
{
2930
class Client;
3031
}
3132

3233
#define NIXL_ETCD_NAMESPACE_DEFAULT "/nixl/agents/"
3334
#endif // HAVE_ETCD
3435

35-
using backend_list_t = std::vector<nixlBackendEngine*>;
36+
using backend_list_t = std::vector<nixlBackendEngine *>;
3637

37-
//Internal typedef to define metadata communication request types
38-
//To be extended with ETCD operations
38+
// Internal typedef to define metadata communication request types
39+
// To be extended with ETCD operations
3940
enum nixl_comm_t {
4041
SOCK_SEND,
4142
SOCK_FETCH,
@@ -47,78 +48,82 @@ enum nixl_comm_t {
4748
#endif // HAVE_ETCD
4849
};
4950

50-
//Command to be sent to listener thread from NIXL API
51-
// 1) Command type
52-
// 2) IP Address
53-
// 3) Port
54-
// 4) Metadata to send (for sendLocalMD calls)
51+
// Command to be sent to listener thread from NIXL API
52+
// 1) Command type
53+
// 2) IP Address
54+
// 3) Port
55+
// 4) Metadata to send (for sendLocalMD calls)
5556
using nixl_comm_req_t = std::tuple<nixl_comm_t, std::string, int, nixl_blob_t>;
5657

5758
using nixl_socket_peer_t = std::pair<std::string, int>;
5859

59-
class nixlAgentData {
60-
private:
61-
std::string name;
62-
nixlAgentConfig config;
63-
nixlLock lock;
64-
65-
// some handle that can be used to instantiate an object from the lib
66-
std::map<std::string, void*> backendLibs;
67-
68-
// Bookkeeping from backend type and memory type to backend engine
69-
backend_list_t notifEngines;
70-
backend_map_t backendEngines;
71-
std::array<backend_list_t, FILE_SEG+1> memToBackend;
72-
73-
// Bookkeping for local connection metadata and user handles per backend
74-
std::unordered_map<nixl_backend_t, nixlBackendH*> backendHandles;
75-
std::unordered_map<nixl_backend_t, nixl_blob_t> connMD;
76-
77-
// Local section, and Remote sections and their available common backends
78-
nixlLocalSection* memorySection;
79-
80-
std::unordered_map<std::string,
81-
std::unordered_map<nixl_backend_t, nixl_blob_t>,
82-
std::hash<std::string>, strEqual> remoteBackends;
83-
std::unordered_map<std::string, nixlRemoteSection*,
84-
std::hash<std::string>, strEqual> remoteSections;
85-
86-
// State/methods for listener thread
87-
nixlMDStreamListener *listener;
88-
std::map<nixl_socket_peer_t, int> remoteSockets;
89-
std::thread commThread;
90-
std::vector<nixl_comm_req_t> commQueue;
91-
std::mutex commLock;
92-
bool commThreadStop;
93-
bool useEtcd;
94-
95-
void commWorker(nixlAgent* myAgent);
96-
void enqueueCommWork(nixl_comm_req_t request);
97-
void getCommWork(std::vector<nixl_comm_req_t> &req_list);
98-
99-
public:
100-
nixlAgentData(const std::string &name, const nixlAgentConfig &cfg);
101-
~nixlAgentData();
60+
class nixlAgentData
61+
{
62+
private:
63+
std::string name;
64+
nixlAgentConfig config;
65+
nixlLock lock;
66+
67+
// some handle that can be used to instantiate an object from the lib
68+
std::map<std::string, void *> backendLibs;
69+
70+
// Bookkeeping from backend type and memory type to backend engine
71+
backend_list_t notifEngines;
72+
backend_map_t backendEngines;
73+
std::array<backend_list_t, FILE_SEG + 1> memToBackend;
74+
75+
// Bookkeping for local connection metadata and user handles per backend
76+
std::unordered_map<nixl_backend_t, nixlBackendH *> backendHandles;
77+
std::unordered_map<nixl_backend_t, nixl_blob_t> connMD;
78+
79+
// Local section, and Remote sections and their available common backends
80+
nixlLocalSection *memorySection;
81+
82+
std::unordered_map<std::string,
83+
std::unordered_map<nixl_backend_t, nixl_blob_t>,
84+
std::hash<std::string>,
85+
strEqual>
86+
remoteBackends;
87+
std::unordered_map<std::string, nixlRemoteSection *, std::hash<std::string>, strEqual>
88+
remoteSections;
89+
90+
// State/methods for listener thread
91+
nixlMDStreamListener *listener;
92+
std::map<nixl_socket_peer_t, int> remoteSockets;
93+
std::thread commThread;
94+
std::vector<nixl_comm_req_t> commQueue;
95+
std::mutex commLock;
96+
bool commThreadStop;
97+
bool useEtcd;
98+
99+
void commWorker(nixlAgent *myAgent);
100+
void enqueueCommWork(nixl_comm_req_t request);
101+
void getCommWork(std::vector<nixl_comm_req_t> &req_list);
102+
103+
public:
104+
nixlAgentData(const std::string &name, const nixlAgentConfig &cfg);
105+
~nixlAgentData();
102106

103107
friend class nixlAgent;
104108
};
105109

106110
class nixlBackendEngine;
107111
// This class hides away the nixlBackendEngine from user of the Agent API
108-
class nixlBackendH {
109-
private:
110-
nixlBackendEngine* engine;
112+
class nixlBackendH
113+
{
114+
private:
115+
nixlBackendEngine *engine;
111116

112-
nixlBackendH(nixlBackendEngine* &engine) { this->engine = engine; }
113-
~nixlBackendH () {}
117+
nixlBackendH(nixlBackendEngine *&engine) { this->engine = engine; }
118+
~nixlBackendH() {}
114119

115-
public:
116-
nixl_backend_t getType () const { return engine->getType(); }
120+
public:
121+
nixl_backend_t getType() const { return engine->getType(); }
117122

118-
bool supportsRemote () const { return engine->supportsRemote(); }
119-
bool supportsLocal () const { return engine->supportsLocal (); }
120-
bool supportsNotif () const { return engine->supportsNotif (); }
121-
bool supportsProgTh () const { return engine->supportsProgTh(); }
123+
bool supportsRemote() const { return engine->supportsRemote(); }
124+
bool supportsLocal() const { return engine->supportsLocal(); }
125+
bool supportsNotif() const { return engine->supportsNotif(); }
126+
bool supportsProgTh() const { return engine->supportsProgTh(); }
122127

123128
friend class nixlAgentData;
124129
friend class nixlAgent;

0 commit comments

Comments
 (0)