Beispiel #1
0
    public VoxelShader(VXGI vxgi)
    {
        _vxgi = vxgi;

        _command = new CommandBuffer {
            name = "VXGI.VoxelShader"
        };

        _arguments = new ComputeBuffer(3, sizeof(int), ComputeBufferType.IndirectArguments);
        _arguments.SetData(new int[] { 1, 1, 1 });
        _lightSources = new ComputeBuffer(64, LightSource.size);

        _kernelAggregate = VXGIRenderPipeline.isD3D11Supported ? 0 : 1;
        _kernelClear     = compute.FindKernel("CSClear");
        _kernelRender    = compute.FindKernel("CSRender");

        _threadsAggregate = new NumThreads(compute, _kernelAggregate);
        _threadsClear     = new NumThreads(compute, _kernelClear);
        _threadsTrace     = new NumThreads(compute, _kernelRender);

        _descriptor = new RenderTextureDescriptor()
        {
            colorFormat       = RenderTextureFormat.RInt,
            dimension         = TextureDimension.Tex3D,
            enableRandomWrite = true,
            msaaSamples       = 1,
            sRGB = false
        };
    }
Beispiel #2
0
 public void SaveToRegistry()
 {
     SetRegistry("User_Agent", UserAgent.Trim());
     SetRegistry("VLC_Location", Vlc_Location.Trim());
     SetRegistry("Timeout", Timeout.ToString());
     SetRegistry("NumTries", NumTries.ToString());
     SetRegistry("NumThreads", NumThreads.ToString());
     SetRegistry("LastDir", LastDir.ToLower().Trim());
 }
Beispiel #3
0
    void InitializeKernel()
    {
        _kernelFilter = 2 * (int)_vxgi.mipmapFilterMode;

        if (!VXGIRenderPipeline.isD3D11Supported)
        {
            _kernelFilter += 1;
        }

        _kernelShift   = compute.FindKernel("CSShift");
        _threadsFilter = new NumThreads(compute, _kernelFilter);
        _threadsShift  = new NumThreads(compute, _kernelShift);
    }
        public void RegisterMetrics(MetricFactory metrics)
        {
            if (!_threadPoolInfo.Enabled && !_runtimeCounters.Enabled)
            {
                return;
            }

            NumThreads = metrics.CreateGauge("dotnet_threadpool_num_threads", "The number of active threads in the thread pool");
            _runtimeCounters.Events.ThreadPoolThreadCount += e => NumThreads.Set(e.Mean);

            Throughput = metrics.CreateCounter("dotnet_threadpool_throughput_total", "The total number of work items that have finished execution in the thread pool");
            _runtimeCounters.Events.ThreadPoolCompletedItemsCount += e => Throughput.Inc(e.IncrementedBy);

            QueueLength = metrics.CreateHistogram("dotnet_threadpool_queue_length",
                                                  "Measures the queue length of the thread pool. Values greater than 0 indicate a backlog of work for the threadpool to process.",
                                                  new HistogramConfiguration {
                Buckets = _options.QueueLengthHistogramBuckets
            }
                                                  );
            _runtimeCounters.Events.ThreadPoolQueueLength += e => QueueLength.Observe(e.Mean);

            NumTimers = metrics.CreateGauge("dotnet_threadpool_timer_count", "The number of timers active");
            _runtimeCounters.Events.ActiveTimerCount += e => NumTimers.Set(e.Mean);

            if (_threadPoolInfo.Enabled)
            {
                AdjustmentsTotal = metrics.CreateCounter(
                    "dotnet_threadpool_adjustments_total",
                    "The total number of changes made to the size of the thread pool, labeled by the reason for change",
                    "adjustment_reason");

                _threadPoolInfo.Events.ThreadPoolAdjusted += e =>
                {
                    AdjustmentsTotal.Labels(_adjustmentReasonToLabel[e.AdjustmentReason]).Inc();
                };

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    // IO threadpool only exists on windows
                    NumIocThreads = metrics.CreateGauge("dotnet_threadpool_io_num_threads", "The number of active threads in the IO thread pool");
                    _threadPoolInfo.Events.IoThreadPoolAdjusted += e => NumIocThreads.Set(e.NumThreads);
                }
            }
        }
Beispiel #5
0
        public void ProcessEvent(EventWrittenEventArgs e)
        {
            switch (e.EventId)
            {
            case EventIdThreadPoolSample:
                // Throughput.Inc((double) e.Payload[0]);
                return;

            case EventIdThreadPoolAdjustment:
                NumThreads.TrackValue((uint)e.Payload[1]);
                AdjustmentsTotal.TrackValue(1, _adjustmentReasonToLabel[(DotNetRuntimeEventSource.ThreadAdjustmentReason)e.Payload[2]]);
                return;

            case EventIdIoThreadCreate:
            case EventIdIoThreadRetire:
            case EventIdIoThreadUnretire:
            case EventIdIoThreadTerminate:
                NumIocThreads.TrackValue((uint)e.Payload[0]);
                return;
            }
        }
Beispiel #6
0
    public VoxelShader(VXGI vxgi)
    {
        _vxgi = vxgi;

        _commandAverage = new CommandBuffer {
            name = "VoxelShader.Average"
        };
        _commandRender = new CommandBuffer {
            name = "VoxelShader.Render"
        };

        _arguments = new ComputeBuffer(3, sizeof(int), ComputeBufferType.IndirectArguments);
        _arguments.SetData(new int[] { 1, 1, 1 });

        if (Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.LinuxPlayer)
        {
            _kernelAverage = 1;
        }
        else
        {
            _kernelAverage = 0;
        }

        _kernelRender = compute.FindKernel("CSRender");

        _propLightColors    = Shader.PropertyToID("LightColors");
        _propLightPositions = Shader.PropertyToID("LightPositions");
        _propRadianceBuffer = Shader.PropertyToID("RadianceBuffer");
        _propResolution     = Shader.PropertyToID("Resolution");
        _propSunColor       = Shader.PropertyToID("SunColor");
        _propSunDirection   = Shader.PropertyToID("SunDirection");
        _propTarget         = Shader.PropertyToID("Target");
        _propVoxelBuffer    = Shader.PropertyToID("VoxelBuffer");

        _threadsAverage = new NumThreads(compute, _kernelAverage);
        _threadsTrace   = new NumThreads(compute, _kernelRender);

        compute.SetVectorArray(_propLightColors, new Vector4[64]);
        compute.SetVectorArray(_propLightPositions, new Vector4[64]);
    }
Beispiel #7
0
    public void Render(ScriptableRenderContext renderContext)
    {
#if UNITY_EDITOR
        _threadsAverage = new NumThreads(compute, _kernelAverage);
        _threadsTrace   = new NumThreads(compute, _kernelRender);
#endif

        var radiances = _vxgi.radiances;

        _commandRender.BeginSample(_commandRender.name);

        _commandRender.SetComputeIntParam(compute, _propResolution, (int)_vxgi.resolution);

        _commandRender.CopyCounterValue(_vxgi.voxelBuffer, _arguments, 0);
        _vxgi.parameterizer.Parameterize(_commandRender, _arguments, _threadsTrace);

        if ((_vxgi.sun != null) && (_vxgi.sun.isActiveAndEnabled))
        {
            Debug.Assert(_vxgi.sun.type == LightType.Directional, "The sun is not directional.", _vxgi.sun);

            _kernelRender = 3;
            _commandRender.SetComputeVectorParam(compute, _propSunColor, _vxgi.sun.color * _vxgi.sun.intensity);
            _commandRender.SetComputeVectorParam(compute, _propSunDirection, _vxgi.sun.transform.forward);
        }
        else
        {
            _kernelRender = 2;
        }

        _commandRender.SetGlobalInt("LightCount", _vxgi.voxelizer.lightColors.Count);

        if (_vxgi.voxelizer.lightColors.Count > 0)
        {
            _commandRender.SetComputeVectorArrayParam(compute, _propLightColors, _vxgi.voxelizer.lightColors.ToArray());
            _commandRender.SetComputeVectorArrayParam(compute, _propLightPositions, _vxgi.voxelizer.lightPositions.ToArray());
        }

        for (var i = 0; i < 9; i++)
        {
            _commandRender.SetComputeTextureParam(compute, _kernelRender, "Radiance" + i, radiances[Mathf.Min(i, radiances.Length - 1)]);
        }

        _commandRender.SetComputeMatrixParam(compute, "VoxelToWorld", _vxgi.voxelToWorld);
        _commandRender.SetComputeMatrixParam(compute, "WorldToVoxel", _vxgi.worldToVoxel);
        _commandRender.SetComputeBufferParam(compute, _kernelRender, _propVoxelBuffer, _vxgi.voxelBuffer);
        _commandRender.SetComputeBufferParam(compute, _kernelRender, _propRadianceBuffer, _vxgi.radianceBuffer);
        _commandRender.DispatchCompute(compute, _kernelRender, _arguments, 0);

        _commandRender.EndSample(_commandRender.name);

        renderContext.ExecuteCommandBuffer(_commandRender);

        _commandRender.Clear();

        _commandAverage.BeginSample(_commandAverage.name);

        _commandAverage.SetComputeBufferParam(compute, _kernelAverage, _propRadianceBuffer, _vxgi.radianceBuffer);
        _commandAverage.SetComputeTextureParam(compute, _kernelAverage, _propTarget, radiances[0]);
        _commandAverage.DispatchCompute(compute, _kernelAverage,
                                        Mathf.CeilToInt((float)_vxgi.resolution / _threadsAverage.x),
                                        Mathf.CeilToInt((float)_vxgi.resolution / _threadsAverage.y),
                                        Mathf.CeilToInt((float)_vxgi.resolution / _threadsAverage.z)
                                        );

        _commandAverage.EndSample(_commandAverage.name);

        renderContext.ExecuteCommandBuffer(_commandAverage);

        _commandAverage.Clear();
    }
Beispiel #8
0
 void UpdateNumThreads()
 {
     _threadsAggregate = new NumThreads(compute, _kernelAggregate);
     _threadsClear     = new NumThreads(compute, _kernelClear);
     _threadsTrace     = new NumThreads(compute, _kernelRender);
 }
Beispiel #9
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            trvProcesses.Nodes.Clear();
            Stopwatch watch = new Stopwatch();

            watch.Start();

            Dictionary <int, ProcessInfo> process_dict =
                new Dictionary <int, ProcessInfo>();

            // Get the processes.
            foreach (Process process in Process.GetProcesses())
            {
                process_dict.Add(process.Id, new ProcessInfo(process));
            }

            // Get the parent/child info.
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(
                "SELECT ProcessId, ParentProcessId FROM Win32_Process");
            ManagementObjectCollection collection = searcher.Get();

            // Create the child lists.
            foreach (var item in collection)
            {
                // Find the parent and child in the dictionary.
                int child_id  = Convert.ToInt32(item["ProcessId"]);
                int parent_id = Convert.ToInt32(item["ParentProcessId"]);

                ProcessInfo child_info  = null;
                ProcessInfo parent_info = null;
                if (process_dict.ContainsKey(child_id))
                {
                    child_info = process_dict[child_id];
                }
                if (process_dict.ContainsKey(parent_id))
                {
                    parent_info = process_dict[parent_id];
                }

                if (child_info == null)
                {
                    Console.WriteLine(
                        "Cannot find child " + child_id.ToString() +
                        " for parent " + parent_id.ToString());
                }

                if (parent_info == null)
                {
                    Console.WriteLine(
                        "Cannot find parent " + parent_id.ToString() +
                        " for child " + child_id.ToString());
                }

                if ((child_info != null) && (parent_info != null))
                {
                    parent_info.Children.Add(child_info);
                    child_info.Parent = parent_info;
                }
            }

            // Convert the dictionary into a list.
            List <ProcessInfo> infos = process_dict.Values.ToList();

            // Sort the list.
            infos.Sort();

            // Populate the TreeView.
            NumProcesses = 0;
            NumThreads   = 0;
            foreach (ProcessInfo info in infos)
            {
                // Start with root processes.
                if (info.Parent != null)
                {
                    continue;
                }

                // Add this process to the TreeView.
                AddInfoToTree(trvProcesses.Nodes, info);
            }
            lblCounts.Text =
                "# Processes: " +
                NumProcesses.ToString() + ", " +
                "# Threads : " +
                NumThreads.ToString();

            watch.Stop();
            Console.WriteLine(string.Format("{0:0.00} seconds",
                                            watch.Elapsed.TotalSeconds));
        }
Beispiel #10
0
 public void Parameterize(CommandBuffer command, ComputeBuffer arguments, NumThreads numThreads)
 {
     command.SetComputeIntParams(_compute, _propNumThreads, numThreads);
     command.SetComputeBufferParam(_compute, _kernelParameterize, _propArguments, arguments);
     command.DispatchCompute(_compute, _kernelParameterize, _arguments, 0);
 }
        public void SaveToFile(string fileName)
        {
            var taxonomyFile = Path.ChangeExtension(fileName, ".taxonomy.xml");

            using (var stream = new FileStream(taxonomyFile, FileMode.Create))
            {
                using (var sw = new StreamWriter(stream, Encoding.UTF8))
                {
                    sw.WriteLine(@"<?xml version=""1.0""?>
<bioml label=""x! taxon-to-file matching list"">
	<taxon label=""all"">
		<file format=""peptide"" URL=""{0}"" />
	</taxon>
</bioml>", DatabaseFile);
                }
            }

            using (var stream = new FileStream(fileName, FileMode.Create))
            {
                using (var sw = new StreamWriter(stream, Encoding.UTF8))
                {
                    sw.WriteLine(@"<?xml version=""1.0""?>
<?xml-stylesheet type=""text/xsl"" href=""tandem-input-style.xsl""?>
<bioml>
<note>list path parameters</note>
	<note type=""input"" label=""list path, taxonomy information"">"     + taxonomyFile + @"</note>

<note>spectrum parameters</note>
	<note type=""input"" label=""spectrum, path"">"     + SpectrumFile + @"</note>
	<note type=""input"" label=""spectrum, parent monoisotopic mass error plus"">"     + PrecursorTolerance.ToString() + @"</note>
	<note type=""input"" label=""spectrum, parent monoisotopic mass error minus"">"     + PrecursorTolerance.ToString() + @"</note>
	<note type=""input"" label=""spectrum, parent monoisotopic mass isotope error"">yes</note>
	<note type=""input"" label=""spectrum, parent monoisotopic mass error units"">"     + (PrecursorTolerancePPM ? "ppm" : "Daltons") + @"</note>
	<note>The value for this parameter may be 'Daltons' or 'ppm': all other values are ignored</note>
	<note type=""input"" label=""spectrum, fragment monoisotopic mass error"">"     + FragmentTolerance.ToString() + @"</note>
	<note type=""input"" label=""spectrum, fragment monoisotopic mass error units"">"     + (FragmentTolerancePPM ? "ppm" : "Daltons") + @"</note>
	<note type=""input"" label=""spectrum, fragment mass type"">monoisotopic</note>
		<note>values are monoisotopic|average </note>

<note>spectrum conditioning parameters</note>
	<note type=""input"" label=""spectrum, dynamic range"">100.0</note>
		<note>The peaks read in are normalized so that the most intense peak
		is set to the dynamic range value. All peaks with values of less that
		1, using this normalization, are not used. This normalization has the
		overall effect of setting a threshold value for peak intensities.</note>
	<note type=""input"" label=""spectrum, total peaks"">50</note> 
		<note>If this value is 0, it is ignored. If it is greater than zero (lets say 50),
		then the number of peaks in the spectrum with be limited to the 50 most intense
		peaks in the spectrum. X! tandem does not do any peak finding: it only
		limits the peaks used by this parameter, and the dynamic range parameter.</note>
	<note type=""input"" label=""spectrum, maximum parent charge"">4</note>
	<note type=""input"" label=""spectrum, use noise suppression"">no</note>
	<note type=""input"" label=""spectrum, minimum parent m+h"">500.0</note>
	<note type=""input"" label=""spectrum, minimum fragment mz"">200.0</note>
	<note type=""input"" label=""spectrum, minimum peaks"">5</note> 
	<note type=""input"" label=""spectrum, threads"">"     + NumThreads.ToString() + @"</note>
	<note type=""input"" label=""spectrum, sequence batch size"">1000</note>
	
<note>residue modification parameters</note>
	<note type=""input"" label=""residue, modification mass"">"     + StaticModification + @"</note>
	<note type=""input"" label=""residue, potential modification mass"">"     + DynamicModification + @"</note>
	<note type=""input"" label=""residue, potential modification motif""></note>
		<note>The format of this parameter is similar to residue, modification mass,
		with the addition of a modified PROSITE notation sequence motif specification.
		For example, a value of 80@[ST!]PX[KR] indicates a modification
		of either S or T when followed by P, and residue and the a K or an R.
		A value of 204@N!{P}[ST]{P} indicates a modification of N by 204, if it
		is NOT followed by a P, then either an S or a T, NOT followed by a P.
		Positive and negative values are allowed.
		</note>

<note>protein parameters</note>
	<note type=""input"" label=""protein, taxon"">all</note>
		<note>This value is interpreted using the information in taxonomy.xml.</note>
	<note type=""input"" label=""protein, cleavage site"">"     + CleavageRole + @"</note>
		<note>this setting corresponds to the enzyme trypsin. The first characters
		in brackets represent residues N-terminal to the bond - the '|' pipe -
		and the second set of characters represent residues C-terminal to the
		bond. The characters must be in square brackets (denoting that only
		these residues are allowed for a cleavage) or french brackets (denoting
		that these residues cannot be in that position). Use UPPERCASE characters.
		To denote cleavage at any residue, use [X]|[X] and reset the 
		scoring, maximum missed cleavage site parameter (see below) to something like 50.
		</note>
	<note type=""input"" label=""protein, cleavage semi"">no</note>
	<note type=""input"" label=""protein, modified residue mass file""></note>
	<note type=""input"" label=""protein, cleavage C-terminal mass change"">17.002735</note>
	<note type=""input"" label=""protein, cleavage N-terminal mass change"">+1.007825</note>
	<note type=""input"" label=""protein, quick acetyl"">yes</note>
	<note type=""input"" label=""protein, quick pyrolidone"">yes</note>
	<note type=""input"" label=""protein, stP bias"">no</note>
	<note type=""input"" label=""protein, N-terminal residue modification mass"">0.0</note>
	<note type=""input"" label=""protein, C-terminal residue modification mass"">0.0</note>
	<note type=""input"" label=""protein, homolog management"">no</note>
		<note>if yes, an upper limit is set on the number of homologues kept for a particular spectrum</note>

<note>model refinement parameters</note>
	<note type=""input"" label=""refine"">yes</note>
	<note type=""input"" label=""refine, modification mass""></note>
	<note type=""input"" label=""refine, sequence path""></note>
	<note type=""input"" label=""refine, tic percent"">20</note>
	<note type=""input"" label=""refine, spectrum synthesis"">yes</note>
	<note type=""input"" label=""refine, maximum valid expectation value"">0.01</note>
	<note type=""input"" label=""refine, unanticipated cleavage"">"     + (RefineUnanticipatedCleavage ? "yes" : "no") + @"</note>
	<note type=""input"" label=""refine, cleavage semi"">no</note>
	<note type=""input"" label=""refine, point mutations"">no</note>
	<note type=""input"" label=""refine, saps"">no</note>
	<note type=""input"" label=""refine, use potential modifications for full refinement"">no</note>
	<note type=""input"" label=""refine, potential N-terminus modifications""></note>
	<note type=""input"" label=""refine, potential C-terminus modifications""></note>
	<note type=""input"" label=""refine, potential modification mass""></note>
	<note type=""input"" label=""refine, potential modification motif""></note>
	<note>The format of this parameter is similar to residue, modification mass,
		with the addition of a modified PROSITE notation sequence motif specification.
		For example, a value of 80@[ST!]PX[KR] indicates a modification
		of either S or T when followed by P, and residue and the a K or an R.
		A value of 204@N!{P}[ST]{P} indicates a modification of N by 204, if it
		is NOT followed by a P, then either an S or a T, NOT followed by a P.
		Positive and negative values are allowed.
		</note>

<note>scoring parameters</note>
	<note type=""input"" label=""scoring, minimum ion count"">4</note>
	<note type=""input"" label=""scoring, maximum missed cleavage sites"">2</note>
	<note type=""input"" label=""scoring, x ions"">no</note>
	<note type=""input"" label=""scoring, y ions"">yes</note>
	<note type=""input"" label=""scoring, z ions"">no</note>
	<note type=""input"" label=""scoring, a ions"">no</note>
	<note type=""input"" label=""scoring, b ions"">yes</note>
	<note type=""input"" label=""scoring, c ions"">no</note>
	<note type=""input"" label=""scoring, cyclic permutation"">no</note>
		<note>if yes, cyclic peptide sequence permutation is used to pad the scoring histograms</note>
	<note type=""input"" label=""scoring, include reverse"">no</note>
		<note>if yes, then reversed sequences are searched at the same time as forward sequences</note>

<note>output parameters</note>
	<note type=""input"" label=""output, log path""></note>
	<note type=""input"" label=""output, message""></note>
	<note type=""input"" label=""output, one sequence copy"">no</note>
	<note type=""input"" label=""output, sequence path""></note>
	<note type=""input"" label=""output, path"">"     + OutputFile + @"</note>
	<note type=""input"" label=""output, sort results by"">spectrum</note>
		<note>values = protein|spectrum (spectrum is the default)</note>
	<note type=""input"" label=""output, path hashing"">yes</note>
		<note>values = yes|no</note>
	<note type=""input"" label=""output, xsl path""></note>
	<note type=""input"" label=""output, parameters"">yes</note>
		<note>values = yes|no</note>
	<note type=""input"" label=""output, performance"">yes</note>
		<note>values = yes|no</note>
	<note type=""input"" label=""output, spectra"">yes</note>
		<note>values = yes|no</note>
	<note type=""input"" label=""output, histograms"">no</note>
		<note>values = yes|no</note>
	<note type=""input"" label=""output, proteins"">yes</note>
		<note>values = yes|no</note>
	<note type=""input"" label=""output, sequences"">no</note>
		<note>values = yes|no</note>
	<note type=""input"" label=""output, one sequence copy"">no</note>
		<note>values = yes|no, set to yes to produce only one copy of each protein sequence in the output xml</note>
	<note type=""input"" label=""output, results"">all</note>
		<note>values = all|valid|stochastic</note>
	<note type=""input"" label=""output, maximum valid expectation value"">100.0</note>
		<note>value is used in the valid|stochastic setting of output, results</note>
	<note type=""input"" label=""output, histogram column width"">50</note>
		<note>values any integer greater than 0. Setting this to '1' makes cutting and pasting histograms
		into spread sheet programs easier.</note>
<note type=""description"">ADDITIONAL EXPLANATIONS</note>
	<note type=""description"">Each one of the parameters for X! tandem is entered as a labeled note
			node. In the current version of X!, keep those note nodes
			on a single line.
	</note>
	<note type=""description"">The presence of the type 'input' is necessary if a note is to be considered
			an input parameter.
	</note>
	<note type=""description"">Any of the parameters that are paths to files may require alteration for a 
			particular installation. Full path names usually cause the least trouble,
			but there is no reason not to use relative path names, if that is the
			most convenient.
	</note>
	<note type=""description"">Any parameter values set in the 'list path, default parameters' file are
			reset by entries in the normal input file, if they are present. Otherwise,
			the default set is used.
	</note>
	<note type=""description"">The 'list path, taxonomy information' file must exist.
		</note>
	<note type=""description"">The directory containing the 'output, path' file must exist: it will not be created.
		</note>
	<note type=""description"">The 'output, xsl path' is optional: it is only of use if a good XSLT style sheet exists.
		</note>

</bioml>
");
                }
            }
        }