Skip to content

Windows Compatibility for multicore running of PerformParamOptimization #23

@likelyamelon

Description

@likelyamelon

DoE Running Begin... Your OS is Windows, there might be unexpected errors. If there is some unexpected bugs, please reduce the 'core' as 1. Error in system("wmic OS get TotalVisibleMemorySize /Value", intern = TRUE) : 'wmic' not found

Traceback to:
system("wmic OS get TotalVisibleMemorySize /Value", intern = TRUE)
9: is.factor(x)
8: gsub("TotalVisibleMemorySize=", "", system("wmic OS get TotalVisibleMemorySize /Value", intern = TRUE)[3])
7: is.factor(x)
6: gsub("\r", "", gsub("TotalVisibleMemorySize=", "", system("wmic OS get TotalVisibleMemorySize /Value", intern = TRUE)[3]))
5: ExperimentsCluster_doe(object = object, object_mslevel = object_mslevel, params = params, isotopeIdentification = isotopeIdentification, BPPARAM = BPPARAM, nSlaves = nSlaves, iterator = iterator)
4: optimizxcms.doe.peakpicking(object = raw_data, params = Parameters, BPPARAM = bp, nSlaves = ncore, subdir = NULL, plot = FALSE)
3: optimize.xcms.doe(raw_data, param = param, ncore = ncore)
2: OptiLCMS::PerformParamsOptimization(mSet = mSet, param = param, method = method, ncore = ncore, running.controller = running.controller)
1: PerformParamsOptimization(mSet, param = SetPeakParam(platform = "HPLC-Q/TOF", polarity = polarity_tag), ncore = 10)

Wmic is no longer supported by new Windows.
To fix this I follow the suggestion from chatgpt
In ExperimentsCluster_doe(), change this Windows block:
memtotal <-
ceiling(as.numeric(gsub(
"\r", "", gsub(
"TotalVisibleMemorySize=",
"",
system('wmic OS get TotalVisibleMemorySize /Value', intern = TRUE)[3]
)
)) / 1024 / 1024)

Replace with
memtotal <- tryCatch(
ceiling(as.numeric(gsub(
"\r", "", gsub(
"TotalVisibleMemorySize=",
"",
system('wmic OS get TotalVisibleMemorySize /Value', intern = TRUE)[3]
)
)) / 1024 / 1024),
error = function(e) NA_real_
)
or you can also manually write your computer memory in like memtotal <-64 *0.6 this "0.6" is giving some buffer, "64" is 64GB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions