Skip to content

Conversation

topepo
Copy link
Member

@topepo topepo commented Nov 5, 2023

No description provided.

@topepo
Copy link
Member Author

topepo commented Nov 6, 2023

I'm getting messages that say

[W MPSFallback.mm:11] Warning: The operator 'aten::sgn.out' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (function operator())

I'm doing some initial testing and the gpu is taking 2x-4x more time than the cpu version

tibble::tribble(
 ~seed,    ~n, ~extra_cols, ~hidden_units, ~epochs,   ~cpu,    ~gpu, ~gpu_to_cpu,
   836, 1e+06,         100,            10,     100,  85.83,  224.07,        2.61,
   836, 1e+06,         100,            10,    1000, 489.62,  934.22,        1.91,
   836, 1e+06,         100,            10,     500, 299.11,  582.33,        1.95,
   836, 1e+06,         100,           100,     100, 441.41, 1977.09,        4.48
 )

Here is a reprex. I'm on an m1 max macstudio (Mac13,1)

library(tidymodels)
library(brulee) # pak::pak(c("tidymodels/brulee#76"), ask = FALSE)

# ------------------------------------------------------------------------------

tidymodels_prefer()
theme_set(theme_bw())
options(pillar.advice = FALSE, pillar.min_title_chars = Inf)

# ------------------------------------------------------------------------------

set.seed(836)
sim_tr <-
 sim_regression(1e+06) %>%
 bind_cols(sim_noise(1e+06, num_vars = 100))

# ------------------------------------------------------------------------------

cpu_time <-
 system.time({
  cpu_fit <-
   brulee_mlp(outcome ~ ., data = sim_tr,
              hidden_units = 10, epochs = 100, stop_iter = 100)
 })

# ------------------------------------------------------------------------------

gpu_time <-
 system.time({
  gpu_fit <-
   brulee_mlp(outcome ~ ., data = sim_tr,
              hidden_units = 10, epochs = 100, stop_iter = 100,
              device = "mps")
 })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant