How to get the options declared in SourceModule - pycuda

I want to know if it is possible to get the options declared in parameters of SourceModule.
How can i do it ?
mod = SourceModule(src_device,
nvcc='/opt/cuda65/bin/nvcc',
options=['-DRANDPHILOX4x32_7','-DPROGRESSION'])
Does it exist a method which do it, something like mod.get_options()
Thanks in advance.

No, as you can see here, compile options passed to the source module are not retained in the SourceModule object. Instead, they pass straight through to the compile system and there is no way to retrieve them after the compilation has been completed.

Related

All usages of a variable/parameter in anylogic

Is there an easy way to figure out all places where a variable or parameter is being utilised in annylogic. Trying to locate where each variable is used can be a pain during debugging.
Sure. Just "ignore" it in the properties and compile the model.
You will get a list of errors for all places where it is called. Double-click on each error and AnyLogic even takes you there :)
Else, you can also use the AnyLogic search functionality.
in order to get some relief for that pain if your model is too big, all your variables should be private and you create setters, so each time you change your variable, you required to use a set function.
This doesn't solve your question, but it tells you what to do in future models to make it easier for you
check this video
https://www.youtube.com/watch?v=gNBfdB6YF7o

Change value of import parameter function module abap

I have a FM with structure in importing. When I try to change field value (wa_str-data = '31129999' for example), the change works, but when I get out of the FM, the field value is reset.
Is it possible to change the field value of a Function Module importing parameter which is of structured type?
Thanks to all.
No, you can't change the value of an IMPORTING parameter (unless it happens to be a TYPE REF TO, in which case you can change the value of the referenced object/data). You can only change values of CHANGING parameters. However, there is a dirty trick you might be able to use here. If you want to access the variable foo in the calling program Z_BAR, then you can do this:
FIELD-SYMBOLS <foo>.
ASSIGN ('(Z_BAR)FOO-DATA') TO <foo>.
IF sy-subrc = 0.
<foo> = newValue.
ENDIF.
(By the way, Z_BAR does not even need to be the direct caller of the function module. It just needs to be somewhere in the call stack.)
Why am I calling this a "dirty" trick?
It creates "spooky effects at a distance". Anyone examining Z_BAR would never expect a function module to change foo when it's not in its parameter list.
The variable name gets resolved at runtime, so there is no syntax check when you misspell it.
It breaks when the variable in the calling program gets renamed, and you won't know until it fails at runtime.
You need to know the name of the calling program in advance. When the function module gets called from another program, then it's not going to work anymore.
So I would only recommend this as a last resort measure.

Using boost's socket.async_send_to()

I've been stuck on this for a while now. I am trying to send the following:
boost::shared_ptr<uint8_t[]> m_data
over the wire using:
_socket.async_send_to(boost::asio::buffer(m_data), m_remote_endpoint,
boost::bind(&UDPServer::handle_send, this, message,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
I get the error "no instance of overloaded function boost::asio::buffer matches the argument list boost::shared_ptr<uint8_t[]>"
m_data is filled in another function.
I suspect this is because I actually have to use the key word new on m_data. But I can't quite figure out how to do it. I've tried a few different variations. Can anybody offer me some insight here? This is probably more a question of how to dereference a shared pointer then anything. Thanks in advance!
boost::asio::buffer has an impressive lists of consttructors, but neither of them takes shared_ptr<[]> (possibly an oversight form lib authors).
In your case, you simply need to derefence shared ptr, for example, by calling get on it.

Error in objective C

I am trying to run unit test whereby I am getting an warning:
'FileName' may not respond to '-failWithException:'
I wanted to know why this warning occurs and how to fix that?
Either the FileName interface does not declare the failWithException: method, or you have not imported the header file in which the interface is declared.
Whatever sort of object FileName is, the compiler can't find a method named '-failWithException' in that class. The solution is to go implement that method on that class, or to make sure the compiler can find the header file where it already is implemented.
By the way, it's a warning instead of an error because, unlike for instance Java, Objective-C allows you to manipulate classes at runtime. So while you PROBABLY have a problem there, you don't DEFINITELY have a problem, so the IDE gives you a yellow warning rather than a red error. But in your case, this is almost certainly something you need to fix.

How to get rid of 'Name ... used only once: possible typo at ...'?

use YAML::XS;
local $YAML::XS::DumpCode=1;
...
I get the warning:
Name "YAML::XS::DumpCode" used only once: possible typo at ..
Well, I know I can suppress this specific warning, but it's kind'a ugly. Am I doing anything wrong? I'm not used to be warned :)
It seems like $YAML::XS::DumpCode is only used from C code, and it is never initialized in YAML/XS.pm (it is there, but commented out). So that might be a bug to submit against that module.
In the mean time, no warnings 'once'; should do the trick.
There is no global variable declared with the name $YAML::XS::DumpCode. This configuration is in the YAML class, so you should set it with local $YAML::DumpCode = 1;: see the documentation.