Calling C code from Julia | Building a Wrapper | Simple Tutorial

preview_player
Показать описание
Julia is a great language for speed and efficiency. Often you can implement many basic numerical algorithms with only very little overhead. Still, sometimes you want to call some code you created in another language, for instance c. Either you have access to the source file or just a compiled shared object, Julia allows calling the code with no overhead.

In this video, we look at how to use the Julia functionality called "ccall". I will show how to compile your code as a shared object. In the end, we will create a simple wrapper to make accessing the code even easier.

-------

-------

Timestamps:
00:00 Introduction
00:20 Compiling into a shared object
00:48 Creating a Function Pointer
01:22 Preallocate the arguments
01:43 Using "ccall" on the Function Pointer
02:31 Building a Wrapper
03:41 Outro
Рекомендации по теме
Комментарии
Автор

Some Remarks on potential performance improvements:
* When preallocating in the wrapper, we don't have to fill it with zeros. We could do an uninitialized allocation by "output = Array{Float64, 1}(undef, n)"

MachineLearningSimulation
Автор

This was great. Thanks for making it so succinct!

CoenArrow
Автор

Thanks for nice video. Interesting!
Could you make a video to show how call Julia code from C language?

javadca
Автор

interesting. curious if tensorflow probability will also available in Julia in the future.

orjihvy