{"id":108,"date":"2019-11-30T23:04:20","date_gmt":"2019-11-30T23:04:20","guid":{"rendered":"http:\/\/localhost\/wordpress\/?p=108"},"modified":"2021-05-29T17:48:21","modified_gmt":"2021-05-29T17:48:21","slug":"julia-embedding","status":"publish","type":"post","link":"http:\/\/localhost\/wordpress\/julia-embedding\/","title":{"rendered":"Julia embedding for C and Fortran"},"content":{"rendered":"\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

Embedding Julia<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

<\/p>\n

Julia is a relatively new programming language that has been designed with High-Performance Computing in mind. Some benchmarks for its speed can be found here<\/a>. This programming language is extremely similar to both python and Fortran\/C. The similarities of Julia to Python is that they are both have high-level dynamically-typed language. However, Julia is a compiled language that can offer better speed since it runs using machine code.<\/p>\n

<\/p>\n

<\/p>\n

While Julia is something that can be used on its own today we will look at how to embed Julia in code such as Fortran and C. Embedding Julia can offer a wide range of use cases when interacting with legacy code. While our examples are simple, they can be adapted for wider more intricate problems. We will only be showing proof of concept.<\/p>\n

The Git Repo can be found here<\/a><\/span><\/p>\n

<\/p>\n

<\/p>\n

<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

Calling Julia From C<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\r\n \r\n \r\n \r\n \r\n \r\n
Function<\/th>\r\n Link (Click these)<\/th>\r\n Description<\/th>\r\n <\/tr>\r\n
C processing Julia Inline base function (Square Num)<\/td>\r\n Calls a Julia function from C<\/a><\/td>\r\n In the C code we pass in an argument of a base Julia function and print out the results. (param number)<\/td>\r\n <\/tr>\r\n
C processing Julia user defined module (Square Num)<\/td>\r\n Calls a Julia user module from C<\/a><\/td>\r\n In the C code we load in a user defined Julia function and pass in a number and print the results. (param number)<\/td>\r\n <\/tr>\r\n
C processing Julia user defined module (Square Array)<\/td>\r\n Calls a Julia user module from C<\/a><\/td>\r\n In the C code we load in a user defined Julia function and pass in an array and print the results. (param Array)<\/td>\r\n <\/tr>\r\n
C processing Julia to write data to file<\/td>\r\n Calls a Julia user module from C to save data<\/a><\/td>\r\n In the C code we load in a user defined Julia function and pass in an array and write it to a file (param Array)<\/td>\r\n <\/tr>\r\n<\/table>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

Calling Julia From FORTRAN to C <\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\r\n \r\n \r\n
Function<\/th>\r\n Link (Click these)<\/th>\r\n Description<\/th>\r\n <\/tr>\r\n
Fortran binding C processing Julia Inline base function to write data<\/td>\r\n Fortran binding C Calling Julia<\/a><\/td>\r\n Fortran binding C to Julia inline function to write data<\/td>\r\n <\/tr>\r\n<\/table>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

For more information please see the Julia website here<\/a><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"

Embedding Julia Julia is a relatively new programming language that has been designed with High-Performance Computing in mind.<\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":115,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[15,16],"tags":[],"yoast_head":"\nJulia embedding for C and Fortran - Jamil Gafur<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/localhost\/wordpress\/julia-embedding\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Julia embedding for C and Fortran - Jamil Gafur\" \/>\n<meta property=\"og:description\" content=\"Embedding Julia Julia is a relatively new programming language that has been designed with High-Performance Computing in mind.Read More\" \/>\n<meta property=\"og:url\" content=\"http:\/\/localhost\/wordpress\/julia-embedding\/\" \/>\n<meta property=\"og:site_name\" content=\"Jamil Gafur\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-30T23:04:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-29T17:48:21+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/localhost\/wordpress\/wp-content\/uploads\/2019\/11\/1200px-Julia_Programming_Language_Logo.svg_.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"776\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"jamilgafur\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jamilgafur\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t \"@context\": \"https:\/\/schema.org\",\n\t \"@graph\": [\n\t {\n\t \"@type\": \"WebPage\",\n\t \"@id\": \"http:\/\/localhost\/wordpress\/julia-embedding\/\",\n\t \"url\": \"http:\/\/localhost\/wordpress\/julia-embedding\/\",\n\t \"name\": \"Julia embedding for C and Fortran - Jamil Gafur\",\n\t \"isPartOf\": {\n\t \"@id\": \"http:\/\/localhost\/wordpress\/#website\"\n\t },\n\t \"primaryImageOfPage\": {\n\t \"@id\": \"http:\/\/localhost\/wordpress\/julia-embedding\/#primaryimage\"\n\t },\n\t \"image\": {\n\t \"@id\": \"http:\/\/localhost\/wordpress\/julia-embedding\/#primaryimage\"\n\t },\n\t \"thumbnailUrl\": \"http:\/\/localhost\/wordpress\/wp-content\/uploads\/2019\/11\/1200px-Julia_Programming_Language_Logo.svg_.png\",\n\t \"datePublished\": \"2019-11-30T23:04:20+00:00\",\n\t \"dateModified\": \"2021-05-29T17:48:21+00:00\",\n\t \"author\": {\n\t \"@id\": \"http:\/\/localhost\/wordpress\/#\/schema\/person\/04ca32a459db6faaa256ee48a444ce34\"\n\t },\n\t \"breadcrumb\": {\n\t \"@id\": \"http:\/\/localhost\/wordpress\/julia-embedding\/#breadcrumb\"\n\t },\n\t \"inLanguage\": \"en-US\",\n\t \"potentialAction\": [\n\t {\n\t \"@type\": \"ReadAction\",\n\t \"target\": [\n\t \"http:\/\/localhost\/wordpress\/julia-embedding\/\"\n\t ]\n\t }\n\t ]\n\t },\n\t {\n\t \"@type\": \"ImageObject\",\n\t \"inLanguage\": \"en-US\",\n\t \"@id\": \"http:\/\/localhost\/wordpress\/julia-embedding\/#primaryimage\",\n\t \"url\": \"http:\/\/localhost\/wordpress\/wp-content\/uploads\/2019\/11\/1200px-Julia_Programming_Language_Logo.svg_.png\",\n\t \"contentUrl\": \"http:\/\/localhost\/wordpress\/wp-content\/uploads\/2019\/11\/1200px-Julia_Programming_Language_Logo.svg_.png\",\n\t \"width\": 1200,\n\t \"height\": 776\n\t },\n\t {\n\t \"@type\": \"BreadcrumbList\",\n\t \"@id\": \"http:\/\/localhost\/wordpress\/julia-embedding\/#breadcrumb\",\n\t \"itemListElement\": [\n\t {\n\t \"@type\": \"ListItem\",\n\t \"position\": 1,\n\t \"name\": \"Home\",\n\t \"item\": \"http:\/\/localhost\/wordpress\/\"\n\t },\n\t {\n\t \"@type\": \"ListItem\",\n\t \"position\": 2,\n\t \"name\": \"Julia embedding for C and Fortran\"\n\t }\n\t ]\n\t },\n\t {\n\t \"@type\": \"WebSite\",\n\t \"@id\": \"http:\/\/localhost\/wordpress\/#website\",\n\t \"url\": \"http:\/\/localhost\/wordpress\/\",\n\t \"name\": \"Jamil Gafur\",\n\t \"description\": \"\",\n\t \"potentialAction\": [\n\t {\n\t \"@type\": \"SearchAction\",\n\t \"target\": {\n\t \"@type\": \"EntryPoint\",\n\t \"urlTemplate\": \"http:\/\/localhost\/wordpress\/?s={search_term_string}\"\n\t },\n\t \"query-input\": \"required name=search_term_string\"\n\t }\n\t ],\n\t \"inLanguage\": \"en-US\"\n\t },\n\t {\n\t \"@type\": \"Person\",\n\t \"@id\": \"http:\/\/localhost\/wordpress\/#\/schema\/person\/04ca32a459db6faaa256ee48a444ce34\",\n\t \"name\": \"jamilgafur\",\n\t \"image\": {\n\t \"@type\": \"ImageObject\",\n\t \"inLanguage\": \"en-US\",\n\t \"@id\": \"http:\/\/localhost\/wordpress\/#\/schema\/person\/image\/\",\n\t \"url\": \"http:\/\/0.gravatar.com\/avatar\/9f97972d46c614454c7669f656485e67?s=96&d=mm&r=g\",\n\t \"contentUrl\": \"http:\/\/0.gravatar.com\/avatar\/9f97972d46c614454c7669f656485e67?s=96&d=mm&r=g\",\n\t \"caption\": \"jamilgafur\"\n\t },\n\t \"url\": \"http:\/\/localhost\/wordpress\/author\/jamilgafur\/\"\n\t }\n\t ]\n\t}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Julia embedding for C and Fortran - Jamil Gafur","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/localhost\/wordpress\/julia-embedding\/","og_locale":"en_US","og_type":"article","og_title":"Julia embedding for C and Fortran - Jamil Gafur","og_description":"Embedding Julia Julia is a relatively new programming language that has been designed with High-Performance Computing in mind.Read More","og_url":"http:\/\/localhost\/wordpress\/julia-embedding\/","og_site_name":"Jamil Gafur","article_published_time":"2019-11-30T23:04:20+00:00","article_modified_time":"2021-05-29T17:48:21+00:00","og_image":[{"width":1200,"height":776,"url":"http:\/\/localhost\/wordpress\/wp-content\/uploads\/2019\/11\/1200px-Julia_Programming_Language_Logo.svg_.png","type":"image\/png"}],"author":"jamilgafur","twitter_card":"summary_large_image","twitter_misc":{"Written by":"jamilgafur","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/localhost\/wordpress\/julia-embedding\/","url":"http:\/\/localhost\/wordpress\/julia-embedding\/","name":"Julia embedding for C and Fortran - Jamil Gafur","isPartOf":{"@id":"http:\/\/localhost\/wordpress\/#website"},"primaryImageOfPage":{"@id":"http:\/\/localhost\/wordpress\/julia-embedding\/#primaryimage"},"image":{"@id":"http:\/\/localhost\/wordpress\/julia-embedding\/#primaryimage"},"thumbnailUrl":"http:\/\/localhost\/wordpress\/wp-content\/uploads\/2019\/11\/1200px-Julia_Programming_Language_Logo.svg_.png","datePublished":"2019-11-30T23:04:20+00:00","dateModified":"2021-05-29T17:48:21+00:00","author":{"@id":"http:\/\/localhost\/wordpress\/#\/schema\/person\/04ca32a459db6faaa256ee48a444ce34"},"breadcrumb":{"@id":"http:\/\/localhost\/wordpress\/julia-embedding\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/localhost\/wordpress\/julia-embedding\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/localhost\/wordpress\/julia-embedding\/#primaryimage","url":"http:\/\/localhost\/wordpress\/wp-content\/uploads\/2019\/11\/1200px-Julia_Programming_Language_Logo.svg_.png","contentUrl":"http:\/\/localhost\/wordpress\/wp-content\/uploads\/2019\/11\/1200px-Julia_Programming_Language_Logo.svg_.png","width":1200,"height":776},{"@type":"BreadcrumbList","@id":"http:\/\/localhost\/wordpress\/julia-embedding\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/localhost\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Julia embedding for C and Fortran"}]},{"@type":"WebSite","@id":"http:\/\/localhost\/wordpress\/#website","url":"http:\/\/localhost\/wordpress\/","name":"Jamil Gafur","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/localhost\/wordpress\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/localhost\/wordpress\/#\/schema\/person\/04ca32a459db6faaa256ee48a444ce34","name":"jamilgafur","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/localhost\/wordpress\/#\/schema\/person\/image\/","url":"http:\/\/0.gravatar.com\/avatar\/9f97972d46c614454c7669f656485e67?s=96&d=mm&r=g","contentUrl":"http:\/\/0.gravatar.com\/avatar\/9f97972d46c614454c7669f656485e67?s=96&d=mm&r=g","caption":"jamilgafur"},"url":"http:\/\/localhost\/wordpress\/author\/jamilgafur\/"}]}},"_links":{"self":[{"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/posts\/108"}],"collection":[{"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":13,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":255,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/posts\/108\/revisions\/255"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/media\/115"}],"wp:attachment":[{"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}