Can I destroy a shader module if a pipeline uses it as one of the stages? - vulkan

Let's say I make a pipeline specifying a module for vertex shader and a module for fragment shader. That pipeline is now created. Do I need to keep the original modules around or are they no longer needed as the pipeline has incorporated their code into its own code?

To quote the spec archive for vkDestroyShaderModule
A shader module can be destroyed while pipelines created using its shaders are still in use.

Related

How can you specify local path of InputPath or OutputPath in Kubeflow Pipelines

I've started using Kubeflow Pipelines to run data processing, training and predicting for a machine learning project, and I'm using InputPath and OutputhPath to pass large files between components.
I'd like to know how, if it's possible, do I set the path that OutputPath would look for a file in in a component, and where InputPath would load a file in a component.
Currently, the code stores them in a pre-determined place (e.g. data/my_data.csv), and it would be ideal if I could 'tell' InputPath/OutputPath this is the file it should copy, instead of having to rename all the files to match what OutputPath expects, as per below minimal example.
#dsl.pipelines(name='test_pipeline')
def pipeline():
pp = create_component_from_func(func=_pre_process_data)()
# use pp['pre_processed']...
def pre_process_data(pre_processed_path: OutputPath('csv')):
import os
print('do some processing which saves file to data/pre_processed.csv')
# want to avoid this:
print('move files to OutputPath locations...')
os.rename(f'data/pre_processed.csv', pre_processed_path)
Naturally I would prefer not to update the code to adhere to Kubeflow pipeline naming convention, as that seems like very bad practice to me.
Thanks!
Update - See ark-kun's comment, the approach in my original answer is deprecated and should not be used. It is better to let Kubeflow Pipelines specify where you should store your pipeline's artifacts.
For lightweight components (such as the one in your example), Kubeflow Pipelines builds the container image for your component and specifies the paths for inputs and outputs (based upon the types you use to decorate your component function). I would recommend using those paths directly, instead of writing to one location and then renaming the file. The Kubeflow Pipelines samples follow this pattern.
For reusable components, you define the pipeline inputs and outputs as part of the YAML specification for the component. In that case you can specify your preferred location for the output files. That being said, reusable components take a bit more effort to create, since you need to build a Docker container image and component specification in YAML.
This is not supported by the system.
Components should use the system-provided paths.
This is important, because on some execution engines the data is mounted to those paths. And sometimes these paths have certain restrictions or might even be unchangeable. So the system must have the freedom to choose the paths.
Usually, good programs do not hard-code any absolute paths inside their code, but rather receive the paths from the command line.
In any case, it's pretty easy to copy the files from or to the system-provided paths (as you already do in the code).

Running load() within Skylark macro

If your project depends on TensorFlow it is recommended that you add...
load("//tensorflow:workspace.bzl", "tf_workspace")
tf_workspace()
...to your WORKSPACE file, which will load all of TF's dependencies.
However, if you look at TensorFlow's workspace.bzl file...
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/workspace.bzl
you can see that it depends on rules from #io_bazel_rules_closure. This means you also have to define this #io_bazel_rules_closure rule in your WORKSPACE file and keep it in sync with TensorFlow, even if you don't need it anywhere else in your project.
Is there a way to add the load() command somehow/somewhere into the tf_workspace() macro?
Thanks!
No, there is no way to add this rule in tf_workspace(), since the skylark rule tf_workspace() defined in https://github.com/tensorflow/tensorflow/blob/master/tensorflow/workspace.bzl needs to load #io_bazel_rules_closure.
There are basically two ways to make this work
either the tensorflow project redefines its rules so that it only uses internal rules or native rules.
or bazel is able to load the workspace of a dependency (and I assume load all the transitive dependencies too). This is a hard problem and is tracked in #1943.

Android studio generating new DaggerComponet.java file

I have defined my Dagger2 component file in a class named LpComponent.java so I need to instantiate things using DaggerLpComponent class reference.
However when I update LpComponent.java file DaggerLpComponent is not getting recreated , only way I can get this is to clean the whole project, and rebuild it.
Is there good old make style dependency I can specify DaggerLpComponent.java depends on LpComponent.java?
Also its not clear to be what rule generates DaggerLpComponent.java file. I have tried ./gradlew tasks to see if there is some dagger specific task that generates the file, but didn't see anything..
Dagger 2 works via annotation processing, which happens at compile time. A simple compilation of your project should trigger the Dagger 2 annotation processor to run and generate new sources. With Android, that should be minimally one of the tasks starting with "compile" that has your build type and flavor in the name.

LSM and in-tree module compilation

I've been experimenting with the LSM functionality in the kernel. Writing, compiling and registering an LSM with the kernel is no issue.
The sources are located in security/mylsm. In addition, I would like to incorporate a kernel module (either loadable or built-in) that is built when a certain configuration parameter is defined (either y or m).
This module defines an interface to some of the data structures of the LSM (that are exported using EXPORT_SYMBOL) for monitoring the system and gathering data. Recompiling the kernel without the module needs to be done in order to remove the interface.
I have placed this module's source in the same directory as the LSM and am having some trouble writing the kbuild makefile. The module source is being compiled, the object files are being generated, however the module does not seem to be getting linked into the kernel image.
The makefile security/mylsm/Makefile looks as follows
obj-(CONFIG_MYLSM) += mylsm.o
mylsm.o := mylsm_src1.o mylsm_src2.o
obj-(CONFIG_MYLSM_DBGMOD) += mylsm_dbg_mod.o
Any idea as to where I might be missing something?

Apache giraph process graph with a custom algorithm

I have a custom algorithm for processing a graph which accepts a txt file as input. Because it is a large scale graph I want to implement it in the apache giraph framework. I' ve done a lot of research but I am still not sure if I am in the right path.
I am reading a .csv file which contain the graph data and using a parser I am converting it to the txt file and uploading to the HDFS file system of hadoop.
I have read the SimpleShortestPathsVertex example from the apache quick start guide and I can see that processes the data from a file in HDFS using the jar-with-dependencies jar file.
My problem is that I haven't yet understood how can I add my algorithm in the apache giraph framework and start the process of the graph. Can I add my algorithm to apache framework using eclipse and modify it from there or there is any other way?
Thank you!
Have a look here:
https://cwiki.apache.org/confluence/display/GIRAPH/Shortest+Paths+Example
Where you able to run this example?
If yes.
Familiarize yourself with the different Writable formats of hadoop! Else it is hard to use these to your algorithm.
All computation concerning the graph is done in the compute() function.
(If you're more advanced have a look into the workerContext preSuperstep and Aggregators!)
You can change the example, but as soon as you use other data types you have to change your VertexReader and VertexWriter.
If you have a specific Algorithm in mind, make up your mind what you need for the computation and specify the layout of your input file. Then adapt your VertexReader and -Writer. And then finaly start the implement your compute() function!
Of course you can use eclipse! Simply Reference the Giraph jar (For me it is "giraph-0.1-jar-with-dependencies.jar") And start coding.
All you need is a instance of these files specific to your algorithm:
YourGiraphJob (the file starting the Hadoop/Giraph job)
YourVertex (Specifies your compute() function executed on each Vertex)
YourInputFormat (Specifying the Writable formats of YourReader)
YourOutputFormat (Specifying the Writable formats of YourWriter)
YourReader (Specifies how your inputFile is transformed e.g. that for each line a Vertex can be initialized using given information)
YourWriter (Specifies how your outputFile is generated from the vertices)
(optionaly a WorkerContext if you want to use Aggregators.)
Simply checkout: http://giraph.apache.org/source-repository.html
using eclipse and you should have the code including an example application you can toy around with!