Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_ram() cannot retrieve RAM #49

Open
alemobile opened this issue Sep 19, 2023 · 4 comments
Open

get_ram() cannot retrieve RAM #49

alemobile opened this issue Sep 19, 2023 · 4 comments

Comments

@alemobile
Copy link

OS and Hardware:

OS: Windows 10, 09-2023 cumulative update (KB5030211)
Laptop Model: HP ENVY Notebook - 15-ae112nl
Processor: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
RAM: 16 GB
R version: 4.3.1 "Beagle Scouts"
benchmarkme package version: 1.0.8

Summary

get_ram() can't retrieve RAM and reports an Error that I don't recognize.

Steps to Reproduce

  1. Run get_ram() in R Console.

Actual Result

The following Error is printed:

Error in inherits(ram, "try-error") || length(ram) == 0L || is.na(ram) : 'length = 3' in coercion to 'logical(1)'

Expected Result

The amount of RAM installed on my laptop (16 GB).

Reported by

Alessandro Mazza.

@ptompalski
Copy link
Contributor

Experienced similar issue:

get_ram()
Error in inherits(ram, "try-error") || length(ram) == 0L || is.na(ram) : 
  'length = 9' in coercion to 'logical(1)'

It seems that the cause of this error is in is.na(ram) - in my case the return values with benchmarkme:::system_ram(os)
is a vector, not a single value:

[1] "68719476736  \r" "68719476736  \r" "68719476736  \r" "68719476736  \r"
[5] "68719476736  \r" "68719476736  \r" "68719476736  \r" "68719476736  \r"
[9] "\r"    

I think is.na(ram) should be changed to any(is.na(ram)). After that change get_ram() works fine on my PC.
I will submit a PR shortly.

@lcolladotor
Copy link

Hi,

As an FYI, from LieberInstitute/spatialLIBD#89 (comment), @sluan-jh found a similar issue with:

─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.4.1 (2024-06-14 ucrt)
 os       Windows 10 x64 (build 19045)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United States.utf8
 ctype    English_United States.utf8
 tz       America/New_York
 date     2024-10-15
 rstudio  2024.04.2+764 Chocolate Cosmos (desktop)
 pandoc   NA

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
 package              * version   date (UTC) lib source
benchmarkme            1.0.8     2022-06-12 [1] CRAN (R 4.4.1)

Best,
Leo

@alemobile
Copy link
Author

In the meantime, I retired my old laptop and bought a new one. The new one also has Windows 11 x64, 16 GB of RAM and R version 4.4.1.

Both the current package function and the patched one suggested by @ptompalski return:

Unable to detect your RAM. # nocov Please raise an issue at https://github.com/csgillespie/benchmarkme

NA B

@alemobile
Copy link
Author

I have an update on this issue. The function get_ram() now works properly. Here are the only differences in software since the last comment:

OS: Windows 11 x64 version 24H2 (KB5046617).
R version: 4.4.2 - "Pile of Leaves".

library(benchmarkme)
get_ram()
15.7 GB

I certainly didn't change any setting (that I know of). I also use RStudio, but it's likely not the source of the problem, because get_ram() works whether I use it with RStudio or not.

However, get_cpu() still presents issues for me (see #48).

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

No branches or pull requests

3 participants