FixedEffects / FixedEffectModels.jl

Fast Estimation of Linear Models with IV and High Dimensional Categorical Variables
Other
225 stars 46 forks source link

error in using gpu? #215

Closed zdlspace0528 closed 1 year ago

zdlspace0528 commented 1 year ago

When I using method = :gpu, it gets an error. I run in Mac OS, version 1.8.1

julia> using RDatasets

julia> using CUDA, FixedEffectModels

julia> df = dataset("plm", "Cigar")

julia> reg(df, @formula(Sales ~ NDI + fe(State) + fe(Year)), method = :gpu, double_precision = false)
ERROR: MethodError: no method matching FixedEffects.AbstractFixedEffectSolver{Float32}(::Vector{FixedEffects.FixedEffect}, ::StatsBase.UnitWeights{Int64}, ::Type{Val{:gpu}}, ::Int64)
Closest candidates are:
  FixedEffects.AbstractFixedEffectSolver{T}(::Vector{<:FixedEffects.FixedEffect}, ::StatsBase.AbstractWeights, ::Type{Val{:cpu}}, ::Any) where T at ~/.julia/packages/FixedEffects/pTBV1/src/FixedEffectSolvers/FixedEffectSolverCPU.jl:111
  FixedEffects.AbstractFixedEffectSolver{T}(::Vector{<:FixedEffects.FixedEffect}, ::StatsBase.AbstractWeights, ::Type{Val{:cpu}}) where T at ~/.julia/packages/FixedEffects/pTBV1/src/FixedEffectSolvers/FixedEffectSolverCPU.jl:111
  FixedEffects.AbstractFixedEffectSolver{T}(::Vector{<:FixedEffects.FixedEffect}, ::StatsBase.AbstractWeights, ::Type{Val{:lsmr_gpu}}) where T at ~/.julia/packages/FixedEffects/pTBV1/src/AbstractFixedEffectSolver.jl:99
  ...
Stacktrace:
 [1] reg(df::Any, formula::FormulaTerm, vcov::StatsBase.CovarianceEstimator; contrasts::Dict, weights::Union{Nothing, Symbol}, save::Union{Bool, Symbol}, method::Symbol, nthreads::Integer, double_precision::Bool, tol::Real, maxiter::Integer, drop_singletons::Bool, progress_bar::Bool, dof_add::Integer, subset::Union{Nothing, AbstractVector}, first_stage::Bool)
   @ FixedEffectModels ~/.julia/packages/FixedEffectModels/kJPKw/src/fit.jl:159
 [2] top-level scope
   @ REPL[5]:1
 [3] top-level scope
   @ ~/.julia/packages/CUDA/DfvRa/src/initialization.jl:52
zdlspace0528 commented 1 year ago
(@v1.8) pkg> st
Status `~/.julia/environments/v1.8/Project.toml`
  [cbdf2221] AlgebraOfGraphics v0.6.11
  [e28b5b4c] Bootstrap v2.3.3
  [336ed68f] CSV v0.10.4
  [052768ef] CUDA v3.12.0
  [13f3f980] CairoMakie v0.8.13
  [324d7699] CategoricalArrays v0.10.6
⌃ [a93c6f00] DataFrames v1.3.4
  [1313f7d8] DataFramesMeta v0.12.0
⌃ [31c24e10] Distributions v0.25.68
  [5789e2e9] FileIO v1.15.0
  [9d5cd8c9] FixedEffectModels v1.7.0
  [c8885935] FixedEffects v2.1.1
  [38e38edf] GLM v1.8.0
  [e9467ef8] GLMakie v0.6.13
⌅ [28b8d3ca] GR v0.66.2
  [c91e804a] Gadfly v1.3.4
  [a2cc645c] GraphPlot v0.5.2
  [86223c79] Graphs v1.7.2
  [7073ff75] IJulia v1.23.3
⌃ [b6b21f68] Ipopt v1.0.4
⌃ [4076af6c] JuMP v1.2.1
  [ee78f7c6] Makie v0.17.13
  [e1d29d7a] Missings v1.0.2
  [5fb14364] OhMyREPL v0.5.12
  [9b87118b] PackageCompiler v2.0.9
  [f0f68f2c] PlotlyJS v0.18.8
⌃ [91a5bcdd] Plots v1.31.7
⌅ [08abe8d2] PrettyTables v1.3.1
  [438e738f] PyCall v1.94.1
  [d330b81b] PyPlot v2.11.0
  [1a8c2f83] Query v1.0.0
  [ce6b1742] RDatasets v0.7.7
⌃ [d519eb52] RegressionTables v0.5.7
  [295af30f] Revise v3.4.0
  [1463e38c] StatFiles v0.8.0
  [3eaba693] StatsModels v0.6.31
⌃ [f3b207a7] StatsPlots v0.15.1
  [db12335b] StringBuilders v0.2.4
  [123dc426] SymEngine v0.8.7
  [24249f21] SymPy v1.1.7
  [0c5d862f] Symbolics v4.10.4
  [bd369af6] Tables v1.7.0
  [ebf5ac4f] TexTables v0.2.6
  [b4f28e30] TikzGraphs v1.4.0
  [112f6efa] VegaLite v2.6.0
matthieugomez commented 1 year ago

Do you have a functional NVIDIA driver? What does CUDA.functional() return?

eloualiche commented 1 year ago

I am going to close this on the assumption that macos does not support nvidia and cuda.