File tree Expand file tree Collapse file tree
excuter/op-mem-ompsimd/src/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,17 +20,22 @@ int main()
2020
2121 server.func = [&mem, &opfactory, &memmutex](const char *buffer)->std ::string
2222 {
23+
24+
2325 deepx::op::Op op;
2426 op.recv_at = chrono::system_clock::now ();
2527 op.load (buffer);
28+ std::string resp=to_string (op.id );
29+ resp+=" recv_at:" ;
30+ resp+=to_string (op.recv_at .time_since_epoch ().count ());
2631 if (opfactory.ops .find (op.name )==opfactory.ops .end ()){
2732 cout<<" <op> " <<op.name <<" not found" <<endl;
28- return " error" ;
33+ resp+= " error op not found " ;
2934 }
3035 auto &type_map = opfactory.ops .find (op.name )->second ;
3136 if (type_map.find (op.dtype )==type_map.end ()){
3237 cout<<" <op>" <<op.name <<" " <<op.dtype <<" not found" <<endl;
33- return " error" ;
38+ resp+= " error dtype not found " ;
3439 }
3540 auto src = type_map.find (op.dtype )->second ;
3641
@@ -42,7 +47,8 @@ int main()
4247 (*src).forward (mem);
4348 }
4449 memmutex.unlock ();
45- return to_string (op.id );
50+ resp+=" success" ;
51+ return resp;
4652 };
4753 server.start ();
4854 return 0 ;
Original file line number Diff line number Diff line change 11from typing import Tuple , List , Optional
22import time
33
4- _id_counter = 0
54class DeepxIR :
65 def __init__ (self ,
76 name :str ,
@@ -39,7 +38,7 @@ def __init__(self,
3938 self ._grad = grad
4039 self ._args_grad = args_grad if grad else []
4140 self ._returns_grad = returns_grad if grad else []
42- self ._id = + + _id_counter
41+ self ._id = None
4342 self ._created_at = time .time ()
4443 self ._sent_at = None
4544
Original file line number Diff line number Diff line change 44import time
55default_client = _default_udpconn
66
7+
8+ _id_counter = 0
79def send (ir :DeepxIR ) -> Optional [dict ]:
810 ir ._sent_at = time .time ()
9- return default_client .send (str (ir ))
11+ global _id_counter
12+ _id_counter = _id_counter + 1
13+ ir ._id = _id_counter
14+ resp = default_client .send (str (ir ))
15+ print (resp )
You can’t perform that action at this time.
0 commit comments