Jutho / TensorOperations.jl

Julia package for tensor contractions and related operations
https://jutho.github.io/TensorOperations.jl/stable/
Other
453 stars 56 forks source link

`TensorOperations.jl` does not seem to support 32-bit Julia? #123

Open frankwswang opened 2 years ago

frankwswang commented 2 years ago

I tried to install the package on a 32-bit Julia and got the precompile error message:

ERROR: LoadError: InexactError: trunc(Int32, 17001435136)
Stacktrace:
 [1] throw_inexacterror(f::Symbol, #unused#::Type{Int32}, val::UInt64)
   @ Core .\boot.jl:614
 [2] checked_trunc_sint
   @ .\boot.jl:636 [inlined]
 [3] toInt32
   @ .\boot.jl:678 [inlined]
 [4] Int32
   @ .\boot.jl:763 [inlined]
 [5] default_cache_size()
   @ TensorOperations PathToPackage\TensorOperations\LDxfx\src\TensorOperations.jl:81
 [6] top-level scope
   @ PathToJuliaEnv\.julia\packages\TensorOperations\LDxfx\src\TensorOperations.jl:91
 [7] include
   @ .\Base.jl:419 [inlined]
 [8] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
   @ Base .\loading.jl:1554
 [9] top-level scope
   @ stdin:1
Jutho commented 2 years ago

Can I infer correctly that you have 64 GB of memory on your machine? But you still use a 32-bit version of Julia. How does that work exactly?

frankwswang commented 2 years ago

I only have 16 GB of memory on my machine. My system is a 64-bit Windows, but I wanted to try out the 32-bit Julia version.

Jutho commented 2 years ago

Oh right, I misinterpreted one line of my code (which could be improved). Still, 32bit would theoretically only allow 4GB of memory. Can you confirm that typeof(Sys.total_memory()) is UInt64 despite using 32-bit Julia?

frankwswang commented 2 years ago

Oh right, I misinterpreted one line of my code (which could be improved). Still, 32bit would theoretically only allow 4GB of memory. Can you confirm that typeof(Sys.total_memory()) is UInt64 despite using 32-bit Julia?

Yes. I can confirm that on my machine, even when running a 32-bit Julia, typeof(Sys.total_memory()) is still UInt64.

Jutho commented 2 years ago

Ok, to fully support this, I would need to change a number of Int to Int32 variables (struct fields) in both LRUCache.jl and TensorOperations.jl

Jutho commented 2 years ago

Since I don't have a 32-bit julia installation at hand, what is the value of something like typeof(sizeof(randn(1,1))). Perhaps I should just change everything to Int64 explicitly to be on the safe side.

frankwswang commented 2 years ago

Since I don't have a 32-bit julia installation at hand, what is the value of something like typeof(sizeof(randn(1,1))). Perhaps I should just change everything to Int64 explicitly to be on the safe side.

For typeof(sizeof(randn(1,1))) it's Int32.