taichi-dev / hackathons

Taichi ❤️ Hackathons
1 stars 2 forks source link

【PaddlePaddle Hackathon 2】89、增加 Taichi 和 PaddlePaddle 高效结合的案例 #2

Open TCChenlong opened 2 years ago

TCChenlong commented 2 years ago

(此 ISSUE 为 PaddlePaddle Hackathon 第二期活动的任务 ISSUE,更多详见 【PaddlePaddle Hackathon 第二期】任务总览

【任务说明】

【提交内容】

【技术要求】

【答疑交流】

0xzhang commented 2 years ago

The least squares algorithm is a classic algorithm and PaddlePaddle doesn't directly support for now. Before I finished the first task. I didn't have a proper idea. Now I'm going to implement a taichi-based lstsq example. Like in reference, add a benchmark would be better. Is this an appropriate idea?

https://jekel.me/2019/Compare-lstsq-performance-in-Python/

PyTorch, TensorFlow and NumPy all support linalg.lstsq.

https://www.netlib.org/lapack/lug/node27.html

yuanming-hu commented 2 years ago

I feel like Taichi may not be the optimal tool for lstsq, which is mainly dense regular matrix operations.

Perhaps it's a good idea to use Taichi and its AutoDiff to implement some weird operators that are not provided by PaddlePaddle? Good examples would be NCReLU (ref1, ref2)/MixedConv (ref). Without Taichi, users will need to implement these kernels using CUDA and bind them to PaddlePaddle through C++/Pybind11. With Taichi you can implement everything in pure "Python" with a small amount of code.

(cc @ailzhang who may also be interested in this topic :-))

0xzhang commented 2 years ago

Thanks for your reply!

It must have been influenced by my working background. I have experience implementing various mathematical operations on supercomputers. But I don't know enough knowledges about deep learning. Therefore in deep learning scope, I don't have a good idea about this task.

And I have also understood a key point following your suggestion. Basic mathmatical operator such as lstsq have already be implemented in a library like NumPy. Taichi doesn't need to build wheels. The real value that Taichi creates is, that developers can use Taichi to implement a variety of customized new algorithms more easier. Based on the Taichi framework, Python-like codes could be translated into high-performance, portable machine codes.

Salut, productivity and performance!

yuanming-hu commented 2 years ago

The real value that Taichi creates is, that developers can use Taichi to implement a variety of customized new algorithms.

Exactly! Taichi is very suitable for writing complex kernels that are hard to compose using basic linear algebra components :-)

0xzhang commented 2 years ago

Thanks! I see. However, due to lack of experience in deep learning, there may be someone more suitable for this task.