yands
Loading Heatmap…

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

1 week ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

1 week ago

yands commented on issue PCL-Platform.Inte.../AISynergy#12

通讯优化,对模型进行切片传输,并进行流处理

从上次实验结果来看,采用多进程的方式来实现的效率最高,所以拟采用多进程的方式来通讯。但进程间是不共享内存的,所以进程间通讯需要对 message 进行序列化和反序列化,主要实现了 clientMessage 和 serverMessage 转换为 Dict 类型的功能。 [代码链接](https://git.openi.org.cn/PCL-Platform.Intelligence/AISynergy/src/branch/streamming/AISynergy-core/src/AISyncore/proto/protobuf_to_dict.py)

2 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

2 weeks ago

yands pushed to master at yands/resnet-datai

2 weeks ago

yands created repository yands/resnet-datai

2 weeks ago

yands commented on issue PCL-Platform.Inte.../AISynergy#12

通讯优化,对模型进行切片传输,并进行流处理

前面的[实验](https://git.openi.org.cn/PCL-Platform.Intelligence/AISynergy/issues/12#issuecomment-22395)结果可以在同时有一个接收和一个发送任务是可以同时利用上行和下行的带宽,基本上可以并行的。 实现了一版基于 Async Reader / Writer Streaming 模式的 [client 代码](https://git.openi.org.cn/PCL-Platform.Intelligence/AISynergy/src/branch/streamming/AISynergy-core/src/AISyncore),但发现并不能充分利用上下行带宽。原因是该方式并不适用于同时有多个接收和多个发送任务的场景,会造成阻塞,程序不运行。 尝试了各种 grpc 的使用方案([方案代码](https://git.openi.org.cn/PCL-Platform.Intelligence/AISynergy/src/branch/streamming/AISynergy-core/src/AISyncore_streaming/bi_stream/multi_thread_exp)),结果如下: | 方案 | 时间 | | -------- | -------- | -------- | | Async Reader / Writer Streaming | async: 23 | | Async Iterator Streaming | async: 18 | | 协程的 loop.call_soon() | async: 18.5 | | 双线程,每个线程一个 channel | sync: 20 | | 双进程,每个进程一个 channel | sync: 14 | | 只 发送/接受 数据 | sync: 10 | > 调研了 grpc 的 grpc.aio 协程模块和 grfc 模块,都不支持收发同时, 只是让程序不用等待 send 函数而运行后面的代码,但 send 和 receive 同时的话是会阻塞的。 > > 所以grpc 一个 chanel 不能同时发送和接受信息。最后采用的方案就是:一个 client 开两个进程,每个进程开一个chanel(链接),一个用于发送,一个用于接收。 > 实验结果: > > | 同步收发 | 只发送 | 只接收 | 异步收发 | > | ----------------------------- | --------- | ------------ | -------- | > | 61s | 20s | 24s | 31s | > > > [实验代码](https://git.openi.org.cn/PCL-Platform.Intelligence/AISynergy/src/branch/streamming/AISynergy-core/src/AISyncore_streaming/bi_stream/multi_thread_exp) > client: > ``` > def read_process(): > streamin_join = init_grpc() > el = get_event_loop() > corots = (comunicate_one_chanel_read(streamin_join, 10)) > el.run_until_complete(corots) > > def write_process(): > streamin_join = init_grpc() > weights = [np.random.rand(1024,1024) for i in range(100)] > el = get_event_loop() > corots = (comunicate_one_chanel_write(streamin_join, weights, 10)) > el.run_until_complete(corots) > > > p1 = Process(target=write_process, args=()) > p2 = Process(target=read_process, args=()) > p1.start() > p2.start() > p1.join() > p2.join() > ``` > >

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

  • 3fc4d1d07a fix bug: adapt new grpc_pipe and send_rceive_proxy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago

yands pushed to streamming at PCL-Platform.Inte.../AISynergy

3 weeks ago