I need to import modules from multiple projects to current project.
Currently I get following message from compiler:
map/map.d(9): Error: module game_object is in file 'steering/game_object.d' which cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import
Projects are set up as follows:
${HOME}/d_apps/steering
${HOME}/d_apps/path_find
${HOME}/d_apps/path_find/map/map.d includes steering.game_object
Compile command:
dmd map/map.d main_visual.d -ofmain_visual -H -gc -unittest -L-lDgame -L-lDerelictUtil -L-lDerelictGL3 -L-lDerelictSDL2 -L-ldl -I/home/real/d_apps/dgame/source -I/home/real/d_apps/derelict_util/source -I/home/real/d_apps/derelict_gl3/source -I/home/real/d_apps/derelict_sdl2/source -I/home/real/d_apps/steering
Just add steering/game_object.d at the start of your dmd command.
I suppose the path of game_object.d is ${HOME}/d_apps/steering/game_object.d. In this case the module is not found because there is no directory specified which contains steering/game_object.d. You need to add -I${HOME}/d_apps or move the file to ${HOME}/d_apps/steering/steering/game_object.d.
Related
I have a directory and inside of the directory are subdirectories and a python file trying to run other files called Main.py. In each of the subdirectories there will be one file called runner.py with its only function I need to execute is “func”. If I want to use importlib.importmodule how would I go about doing that. As of right now I’m iterating over the directory and using:
filepath = sys.argv\[1\] + "/runner.py"
student_module = importlib.import_module("func", filepath)
But I’m afraid I don’t know how to use it properly as I’m new to python.
In case my words weren’t clear the directory architecture is as follows
Directory
->Main.py
->Subdirectory(1)
->runner.py
->Subdirectory(2)
->runner.py
.
.
.
->Subdirectory(n)
->runner.py
I had tried using the snippet of code above and I was expecting to be able to run the func from the different runner.py files. Unfortunately I’m getting a:
ModuleNotFoundError: No module named ‘func’
I have installed the 'econml' package but when I try to import DML, using :
from econml.dml import DML
I am getting the following error:
'ImportError: cannot import name 'show_config' from 'numpy' (unknown location)'
I am wondering how can I fix this issue.
Two steps:
Find any file named as "numpy.py" in your script directory and change it into another name.
Delete any file named as "numpy.pyc" or any other file generated while compiling your code.
I was wondering how to import sv packages while using YOSYS. For instance
In the file my_pkg.sv I have the following
package my_pkg;
parameter KL=64;
endpackage
Now in the file top.sv I have the following
import my_pkg::*;
module top(
input logic i_clk,
output logic o_done
);
endmodule
Yosys gives the following error:
top.sv:1: ERROR: syntax error, unexpected TOK_ID
I was expecting YOSYS to accept the syntax since I am merely importing the package into the top level file. This is a common way to import all the content of a package inside a module and hence avoid having to prefix the package name every time a package parameter is used inside the module. This works in Modelsim, VCS as well as in DC. Is there a way to accomplish this in Yosys?
Looks like Yosys (Yosys 0.9+1706 git sha1 ff4ca9dd, gcc 8.4.0-1ubuntu1~18.04 -fPIC -Os) does not support top level imports. One possible workaround is to use a tool to convert the SystemVerilog code into verilog and then feed the verilog code into Yosys. One such a tool is sv2v from Zach Snow (kudo to Zach for the hint) at https://github.com/zachjs/sv2v.
I don't understand how to work with F# header files.
I have two test files:
Foo.fs:
module Foo
let add a b = a + b
Program.fs:
open Foo
printfn "%d" (add 8 2)
In the file Program.fs, Visual Studio tells me:
Files located in libraries or applications containing multiple files
must start with a namespace or module declaration.
Only the last source file of an
application can omit such a statement.
However, I did the right thing: start my Foo.fs file with a module declaration. If I declare a namespace or module to Program.fs, the error persists. So I don't have access to the add function.
How do I import this file?
I'm trying to serve a model exported from syntaxnet but the parser_ops are not available. The library file with the ops is found (out-of-tree) at:
../models/syntaxnet/bazel-out/local-opt/bin/syntaxnet/parser_ops.so
I'm currently hacking the mnist_inference example, (because I don't know how to build anything out-of-tree with bazel), and the command I'm running is:
./bazel-out/local-opt/bin/tensorflow_serving/example/mnist_inference --port=9000 /tmp/model/00000001
And the error I'm getting is:
F tensorflow_serving/example/mnist_inference.cc:208] Check failed: ::tensorflow::Status::OK() == (bundle_factory->CreateSessionBundle(bundle_path, &bundle)) (OK vs. Not found: Op type not registered 'FeatureSize')
And FeatureSize is definitely defined in the parser_ops.so, I just don't know how to load it.
I'm not too familiar with TF (I work on Bazel) but it looks like you need to add parser_ops as a dependency of mnist_inference.
There is a right way to do this and a wrong (easier) way.
The Right Way
Basically you add syntaxnet as a dependency of the example you're building. Unfortunately, the syntax net project and the tensorflow serving project import tensorflow itself under different names, so you have to do some mangling of the serving WORKSPACE file to get this working.
Add the following to the tensorflow_serving WORKSPACE file:
local_repository(
name = "syntaxnet",
path = "/path/to/your/checkout/of/models/syntaxnet",
)
This allows you to refer to the targets in syntaxnet from the tensorflow project (by prefixing them with "#syntaxnet"). Unfortunately, as mentioned above, you also have to get all of syntaxnet's external dependencies into the WORKSPACE file, which is annoying. You can test out if it's working with bazel build #syntaxnet//syntaxnet:parser_ops_cc.
Once you've done that, then add the cc_library #syntaxnet//syntaxnet:parser_ops_cc (parser_ops.so is a cc_binary, which can't be used as a dependency) to mnist_inference's deps:
deps = [
"#syntaxnet//syntaxnet:parser_ops_cc",
"#grpc//:grpc++",
...
Note that this still won't quite work: parser_ops_cc is a private target in syntaxnet (so it can't be depended on from outside its package) but you could add an attribute to it like visibility = ["//visibility:public"] if you're just trying things out:
cc_library(
name = "parser_ops_cc",
srcs = ["ops/parser_ops.cc"],
visibility = ["//visibility:public"]
...
The Wrong Way
You have a .so, which you can add a src file for your binary. Add the directory it's in as a new_local_repository() and add it to srcs in the BUILD file.
WORKSPACE file:
new_local_repository(
name = "hacky_syntaxnet",
path = "/path/to/syntaxnet/bazel-out/local-opt/bin/syntaxnet",
build_file_content = """
exports_files(glob(["*"])) # Make all of the files available.
""",
)
BUILD file:
srcs = [
"mnist_inference.cc",
"#hacky_syntaxnet//:parser_ops.so"
],