gil | git links tool to manage complex recursive repositories | Version Control System library
kandi X-RAY | gil Summary
kandi X-RAY | gil Summary
Gil is a git links tool to manage complex git repositories dependencies with cycles and cross references. This tool provides a solution to the git recursive submodules dependency problem.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Discover active records
- Process git links
- Discover directories recursively
- Discover git links in a given path
- Splits a line into quotes
- Clone the repository
- Run git clone
- Link files
- Update git links from a file
- Create a git link
- Recursively links the given directory
- Update the link between src_path and dst_path
- Link to the given path
- Show help for the git command
- Run a git command
- Run git checkout command
- Show current configuration
- Show the current version
gil Key Features
gil Examples and Code Snippets
Community Discussions
Trending Discussions on gil
QUESTION
I'm trying to learn how to use threading and specifically concurrent.futures.ThreadPoolExecutor
this is because I need to return a numpy.array
from a function I want to run concurrently.
The end goal is to have one process running a video loop of an application, while another process does object detection and GUI interactions. The result()
keyword from the concurrent.futures library allows me to do this.
The issue is my code runs once, and then seems to lock up. I'm actually unsure what happens as when I step through it in the debugger it runs once, then the debugger goes blank and I literally cannot step through and no error is thrown.
The code appears to lock up on the line: notepadWindow = pygetwindow.getWindowsWithTitle('Notepad')[0]
I get exactly one loop, the print
statement prints once the loop restarts and then it halts at pygetwindow
I don't know much about the GIL but I have tried using the max_workers=1
argument on ThreadPoolExecutor()
which doesn't make a difference either way and I was under the impression concurrent.futures
allows me to bypass the lock.
How do I run videoLoop
as a single thread making sure to return DetectionWindow
every iteration?
ANSWER
Answered 2022-Mar-28 at 11:08A ThreadPoolExecutor won't help you an awful lot here, if you want a continuous stream of frames.
Here's a reworking of your code that uses a regular old threading.Thread
and puts frames (and their capture timestamps, since this is asynchronous) in a queue.Queue
you can then read in another (or the main) thread.
The thread has an otherwise infinite loop that can be stopped by setting the thread's exit_signal
.
(I didn't test this, since I'm presently on a Mac, so there may be typos or other problems.)
QUESTION
for og_raw_file in de_core.file.rglob(raw_path_object.url):
with de_core.file.open(og_raw_file, mode="rb") as raw_file, de_core.file.open(
staging_destination_path + de_core.aws.s3.S3FilePath(raw_file.name).file_name, "wb"
) as stager_file, concurrent.futures.ThreadPoolExecutor() as executor:
logger.info("Submitting file to thread to add metadata", raw_file=raw_file)
executor.submit(
,
raw_path_object,
<...rest of arguments to function>
)
...ANSWER
Answered 2022-Mar-09 at 03:26Start by reading the docs for Executor.shutdown()
, which is called by magic with wait=True
when the with
block ends.
For the same reason, if you run this trivial program you'll see that you get no useful parallelism either:
QUESTION
I am fairly new to Python and .NET in general, but decided to ask more competent people, since I have been struggling with the issue of executing python script from Windows Forms.
The basic idea of my project is a desktop applicaton and the overall logic would be to read from a couple of selected check boxes, pass the values of those selections to my python script, from there I generate an excell table based on those results, and display this table back into the Windows Forms application.
Creating the table and managing to display it in the Desktop App is already done, but I am having serious issues with the communication between the two platforms, when it came to executing the script itself.
I have tried using IronPython and it worked perfectly, untill the fact that I found that Iron Python does not support CPython packages, like Pandas, which is build on numpy, and numpy apparantly is one of those packages. I looked over a lot of articles about this issue and the answers did not seem promising and most of the suggestions were to use pythonnet.
I tried to implement pythonnet, following numerous articles and all I managed to do, besides creating a bigger mess, is nothing as a result.
Finally, I decided to use C# Process class, but did not succeed also.
Would appreciate if there are any comments and suggestions on how to remedy this issue.
...ANSWER
Answered 2022-Feb-23 at 19:34I did a project like this recently; a couple of things I would suggest to make it easy:
Confirm that the instance of python set in your env variables (WIN+R, sysdm.cpl, Advanced, env variables) is that of the instance of python you wish to use (do this for your python search path too!)
Remove any lines attempting to set these in code; and instead handle errors if they are not found
Then, when you call you script from within your program; it only needs to look like this:
QUESTION
I am writing a pine script code to plot some lines conditionally. I see pine script v5, plot() function has display argument, still I am getting an weird error. Any idea what it could be?
Code:
...ANSWER
Answered 2022-Feb-12 at 08:09You should apply your condition to the series
argument of plot()
. The display
argument is whether to enable or disable the plot by default and I believe it must be a constant.
And you probably want to change the style to something like plot.style_circles
so your line won't be connected.
QUESTION
I have the following C# code:
...ANSWER
Answered 2022-Feb-07 at 20:52okay so python.net installation is really not well documented and the folks maintaining the python.net repository don't really help a lot since it's not a "support forum".
I solved this issue by installing the python.runtime.AllPlatflorms nuget package and pointing the environment variables to the right python folders/ files.
This works with python3.8 as well.
QUESTION
I have a pretty large project converted to Numba, and after run #1 with @nb.njit(cache=True, parallel=True, nogil=True), well, it's slow on run #1 (like 15 seconds vs. 0.2-1 seconds after compiling). I realize it's compiling byte code optimized for the specific PC I'm running it on, but since the code is distributed to a large audience, I don't want it to take forever compiling the first run after we deploy our model. What is not covered in the documentation is a "generic x64" cache=True method. I don't care if the code is a little slower on a PC that doesn't have my specific processor, I only care that the initial and subsequent runtimes are quick, and prefer that they don't differ by a huge margin if I distribute a cache file for the @njit functions at deployment.
Does anyone know if such a "generic" x64 implementation is possible using Numba? Or are we stuck with a slow run #1 and fast ones thereafter?
Please comment if you want more details; basically it's around a 50 lines of code function that gets JIT compiled via Numba and afterwards runs quite fast in parallel with no GIL. But I'm willing to give up some extreme optimization if the code can work in a generic form across multiple processors. As where I work, the PCs can vary quite a bit in terms of how advanced they are.
I looked briefly at the AOT (ahead of time) compilation of Numba functions, but these functions, in this case, have so many variables being altered I think it would take me weeks to decorate properly the functions to be compiled without a Numba dependency. I really don't have the time to do AOT, it would make more sense to just rewrite in Cython the whole algorithm, and that's more like C/C++ and more time consuming that I want to devote to this project. Unfortunately there is not (to my knowledge) a Numba -> Cython compiler project out there already. Maybe there will be in the future (which would be outstanding), but I don't know of such a project out there currently.
...ANSWER
Answered 2022-Feb-06 at 01:12Unfortunately, you mainly listed all the current available options. Numba functions can be cached and the signature can be specified so to perform an eager compilation (compilation at the time of the function definition) instead of a lazy one (compilation during the first execution). Note that the cache=True
flag is only meant to skip the compilation when it as already been done on the same platform before and not to share the code between multiple machine. AFAIK, the internal JIT used by Numba (LLVM-Lite) does not support that. In fact, it is exactly the purpose of the AOT compilation to do that. That being said, the AOT compilation requires the signatures to be provided (this is mandatory whatever the approach/tool used as long as the function is compiled) and it has quite strong limitations (eg. currently there is no support for parallel codes and fastmath). Keep in mind that Numba’s main use case is Just-in-Time compilation and not the ahead-of-time compilation.
Regarding your use-case, using Cython appears to make much more sense: the functions are pre-compiled once for some generic platforms and the compiled binaries can directly be provided to users without the need for recompilation on the target machine.
I don't care if the code is a little slower on a PC that doesn't have my specific processor.
Well, regarding your code, using a "generic" x86-64 code can be much slower. The main reasons lie in the use of SIMD instructions. Indeed, x86-64 processors all supports the SSE2 instruction set which provide basic 128-bit SIMD registers working on integers and floating-point numbers. Since about a decade, x86-processors supports the 256-bit AVX instruction set which significantly speed up floating-point computations. Since at least 7 years, almost all mainstream x86-64 processors supports the AVX-2 instruction set which mainly speed up integer computations (although it also improves floating-point thanks to new features). Since nearly a decade, the FMA instruction set can speed up codes using fuse-multiply adds by a factor of 2. Recent Intel processors support the 512-bit AVX-512 instruction set which not only double the number of items that can be computed per instruction but also adds many useful features. In the end, SIMD-friendly codes can be up to an order of magnitude faster with the new instruction sets compared to the obsolete "generic" SSE2 instruction set. Compilers (eg. GCC, Clang, ICC) are meant to generate a portable code by default and thus they only use SSE2 by default. Note that Numpy already uses such "new" features to speed up a lot many functions (see sorts, argmin/argmax, log/exp, etc.).
QUESTION
I am creating a Python module (module.so
) following pybind11's tutorial on trampolines:
ANSWER
Answered 2022-Jan-29 at 18:27Receiving raw pointers usually* means you don't assume ownership of the object. When you receive IReader*
in the constructor of C
, pybind11 assumes you will still hold the temporary PklReader()
object and keep it alive outside. But you don't, so it gets freed and you get a segfault.
I think
QUESTION
I want to create a special case of a room-impulse-response. I am following this implemetation for a room-impulse-response generator. I am also following this tutorial for integrating c++\c with python.
According to the tutorial:
- You want to speed up a particular section of your Python code by converting a critical section to C. Not only does C have a faster execution speed, but it also allows you to break free from the limitations of the GIL, provided you’re careful.
However, when looking at the MATLAB example, all I see the cpp code segment doing, are regular loops and mathematical computations. In what way will c\cpp be faster than python\MATLAB in this example or any other? Will any general c\cpp code run faster? If so, why? If not, what are the indicators I need to look for, when opting for a c\cpp segment implementation? which operations are faster in c\cpp?
...ANSWER
Answered 2022-Jan-16 at 15:31C++ code compiles into machine code. This makes it faster compared to interpreter languages (however not every code written in C++ is faster than Python code if you don't know what you are doing). in C++ you can access the data pointers directly and use SIMD instructions on them to make them multiple times faster. You can also multi-thread your loops and codes to make them run even faster (either explicit multi-threading or tools like OpenMP). You can't do these things (at least properly) in a high level language).
When to use C++ to speedup PythonNot every part of the code is worth optimizing. You should only optimize the parts that are computationally expensive and are a bottleneck of your program. These parts can be written in C or C++ and exposed to python by using bindings (by using pybind11 for example). Big machine learning libraries like PyTorch and TensorFlow do this.
Dedicated HardwareSometimes having a well optimized C++ CPU code is not enough. Then you can assess your problem and if it is suitable, you can use dedicated hardware. These hardware can go from low-level (like FPGA) to high-level hardware like dedicated graphics cards we usually have on our system (like CUDA programming for NVIDIA GPUs).
Regular Code Difference in Low and High Level LanguagesUsing a language that compiles has great advantages even if you don't use multi-threading or SIMD operations. For example, looping over a C array or std::vector
in C++ can be more than 100x faster compared to looping over Python arrays or using for
in MATLAB (recently JIT compiling is being used to speed up high-level languages but still, the difference exists). This has many reasons, some of which are basic data types that are recognized at compile time and having contiguous arrays. This is why people recommend using Numpy vectorized operations over simple Python loops (same is recommended for MATLAB).
QUESTION
For some, simple thread related code, i.e:
...ANSWER
Answered 2021-Nov-17 at 14:58An answer from a core developer:
Unintended consequence of Mark Shannon's change that refactors fast opcode dispatching: https://github.com/python/cpython/commit/4958f5d69dd2bf86866c43491caf72f774ddec97 -- the INPLACE_ADD opcode no longer uses the "slow" dispatch path that checks for interrupts and such.
QUESTION
Based on what I have read - for example here - I understand the I/O operations release the GIL. So, if I have to read a large number of files on the local filesystem, my understanding is that a threaded execution should speed things up.
To test this - I have a folder (input
) with about ~100k files - each file has just one line with one random integer. I have two functions - one "sequential" and one "concurrent" that just add all the numbers
ANSWER
Answered 2022-Jan-01 at 11:31Note: The following only applies to HDDs, which have moving parts that can affect read throughput, not SDDs. The nature of the large performance difference makes it clear to me that this is a HDD-oriented problem, so this information operates under that assumption.
The problem is that while the threads may be operating in parallel, the data must be read sequentially from the hard drive as there is only the singular read head. Worse, however, is that since you've parallelized the I/O operations, the underlying OS will schedule these I/O tasks such that these files are processed only partially before switching to another thread--after all, even if you only have a single integer, the files headers still need to be processed as well--causing the read head to jump around much more wildly than in your strictly sequential code. All of this results in massively increased overhead compared to simply reading the entirety of each file in sequence, which doesn't require so many jumps.
This wouldn't be as much of a problem if, for instance, you had a single thread loading in large amounts of data from disk while a second thread performs some time-intensive processing of it, as that would allow the time-intensive processing to continue unblocked by the I/O operations. Your particular scenario is just a really, really bad case where you've given up a GIL bottleneck in exchange for a horrifically slow I/O bottleneck.
In short, you've understood correctly that I/O operations release the GIL, you just came to the wrong conclusion about parallelizing file reads.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gil
~/gil/sample/CppBenchmark/build
~/gil/sample/CppCommon/build
~/gil/sample/CppLogging/build
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page