Skip to content

Commit

Permalink
add JuliaCall example
Browse files Browse the repository at this point in the history
  • Loading branch information
kongdd committed Feb 16, 2024
1 parent f668254 commit b99d608
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
25 changes: 25 additions & 0 deletions julia/hello.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
lib = "bld/clm5/libclm.so"
# lib = "/home/kong/eCLM/bld/clm5/libclm.a"
# real(r8) function daylength(lat, decl)
const FT = Cdouble

daylength(lat::FT, decl::FT) =
@ccall lib.__daylengthmod_MOD_daylength(lat::Ref{FT}, decl::Ref{FT})::FT

lat = 20.0 |> deg2rad
decl = 20.0 |> deg2rad

@show daylength(lat, decl)

## Fix curl error
# > /home/kong/packages/julias/julia-1.10/bin/../lib/julia/libcurl.so.4: version `CURL_OPENSSL_4' not found (required by /lib/x86_64-linux-gnu/libnetcdf.so.19)

# /home/kong/packages/julias/julia-1.10/bin/../lib/julia/libcurl.so.4 -> libcurl.so.4.8.0
# ll /home/kong/packages/julias/julia-1.10/lib/julia/libcurl.so.4

# ln -sf /home/kong/packages/julias/julia-1.10/lib/julia/libcurl.so.4.8.0 /home/kong/packages/julias/julia-1.10/lib/julia/libcurl.so.4
# ln -sf /usr/lib/x86_64-linux-gnu/libcurl.so.4.7.0 /home/kong/packages/julias/julia-1.10/lib/julia/libcurl.so.4


## Julia
# ln -sf libcurl.so.4.8.0 /home/kong/packages/julias/julia-1.10/lib/julia/libcurl.so.4
12 changes: 12 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# export NCDIR=${HOME}/environment/netcdf
# export PNDIR=${HOME}/environment/pnetcdf
# export LD_LIBRARY_PATH=$NCDIR:$PNDIR:$LD_LIBRARY_PATH
# export PATH=$NCDIR/bin:$PATH

export NETCDF=$NCDIR

export NETCDF_C_PATH=$NCDIR
export NETCDF_FORTRAN_PATH=$NCDIR
export PNETCDF_PATH=$PNDIR


# User-specific variables
BUILD_DIR="bld"
INSTALL_DIR="eclm"
Expand Down

0 comments on commit b99d608

Please sign in to comment.