How can I turn of the report generation in OpenMDAO 3.17?
I've tried add the following code to the top of my script:
import os
os.environ['OPENMDAO_REPORTS'] = 'none'
In place of 'none', I've also tried '0', 'false', and 'off' as mentioned here in the OpenMDAO documentation. This is the only way I've seen to change the environment variables.
Are there other ways to permanently change them such as through the command prompt? I'm relatively new to python, so spelling it out for me would be helpful.
Also, I know this is a repost, but I don't have enough points to add a comment to that post. So I've had to create a new post. That post also mentioned a PR, but the summary indicates the report generation was only fixed for some Dymos functionality.
When you change the setting via a python script (as your question shows) you are only changing it for that active python session. Not permenantly.
You don't say whether you're on windows or linux, which changes the specific method you would use to achieve your goal; Generally though, you can set the environment variable so that its given whenever you open a terminal. This will have the effect you desire.
On windows, you set environment variables via a small system GUI. On linux you change them by adding a line to a config file (usually .bashrc). On Mac the file name is sometimes .bash_profile or .profile.
I couldn't get them to switch off via environmental variables, whether setting them in the python script or from the terminal, but when creating the problem this worked
p = om.Problem(model=om.Group(), reports=False)
Related
Console My ## tag is not changing color, what can I do to change that?
I have tried looking for a solution in my settings, but there has been no luck.
The console isn't a place to make and keep notes. The console isn't something that gets saved, so if you are trying to add notes to a script, you probably want to create a new script.
In R itself, I am not sure if or how you have notes (in scripts) change colors, but this happens automatically in some "Integrated Development Environments (IDE)", such as RStudio. For learning how to use R, I would recommend downloading RStudio. When you create a script there, your comments starting with # will automatically be a different color than code.
Is there a way to check currently set variables and their corresponding values when running a project in RStudio?
This is for debugging purposes and am seeking an alternative to the browser() command. The browser command does not always work it seems.
I wouldn't necessarily say it's a debugging tool, and I honestly like working with browser(), but are you aware of the environment tab? Sound exactly like what you are describing. It's usually a tab in the pane alongside 'history', 'connections' and 'git' and lists e.g. variable names and values and allows you to inspect them.
My goal is to be able to reasonably debug any R-based code, even code from libraries (from install.packages, by placing breakpoints or debug statements (i.e., browser) at any line. I haven't been able to figure out how to reliably edit the source of any library function yet (assuming it is not compiled, e.g., editing a S3 method). However, I put a breakpoint in my main function and then used the debugger to step into the code for the library of interest. In RStudio, the file says "Debug location is approximate because the source is not available." That's fine, but I would like to be able to put additional breakpoints into this "virtual file" so that I don't have to step line by line until I get to the line of interest. Placing these breakpoints does not seem to be possible.
I also can't figure out how to edit the file (which would presumably then support breakpoints). Perhaps I need to install the source locally but it is not clear how to do that. Also, I don't know what the implications of using the source code is. Would I need to manually compile any parts of the library that are actually compiled? My preference would be to have an installation option that allows for editing anything that is interpreted but that doesn't force me to compile everything that the standard installation method typically compiles on its own.
Try:
trace(Fun_name, edit = T)
I have two gpus, and want to open a second juptyer notebook and ensure everything within it runs only on the second gpu rather than the first. Ideally I'd like to do this by running a cell at the start rather than passing device=1 in multiple places.
The answer in this scenario is to call set device.
import torch
torch.cuda.set_device(1)
The docs however discourage it. According to the github note on the checkin (https://github.com/pytorch/pytorch/issues/260) my scenario is the only reasonable use case. The preferred method is to set an environment variable, which is also possible in the notebook case:
import os
os.environ['CUDA_VISIBLE_DEVICES']='1'
I use the atom-runner package, which runs scripts when I click alt+x:
Now, I also installed the gpp-compiler package, which runs c++ files when I click F5:
It is confusing to have two different key-bindings for running. I would like to use alt+x both for gpp-compiler and for atom-runner, based on the file: if it's a c/c++ file then run gpp-compiler, otherwise run atom-runner.
Is this possible?
You are in luck. I was doing something similar to this recently and thought that this could be done.
I've made an Atom package to do what you're looking for. You can find it at https://atom.io/packages/multi-hotkey. The default hotkey is Ctrl-M.
Currently only one hotkey is possible, but with customization available for four different user-inputted file extensions and corresponding commands, and a final command for anything not matching the preceding extensions.