gpuBenchApp

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 classdef GPUBenchApp < handle
0002 %
0003 % Usage:
0004 %     app.GPUBenchApp
0005 
0006   properties
0007       AppPath = {'/GPUBench'};
0008       AppClass = 'GPUBenchApp';
0009       AppHandle;
0010       AppCount = 0;
0011       Increment = 1;
0012       Decrement = 0;
0013       Output;
0014       CurrClass;
0015       Version = '13a';
0016   end  
0017   methods (Static)
0018       function count = refcount(increment)
0019           persistent AppCount;
0020           if(isempty(AppCount))              
0021               AppCount = 1;
0022           else
0023               if(increment)
0024                   AppCount = plus(AppCount,1);
0025               else
0026                   AppCount = minus(AppCount,1);
0027               end
0028           end
0029           count = AppCount;
0030        end
0031   end
0032   
0033   methods
0034     % Create the application object
0035     function obj = GPUBenchApp()      
0036       obj.CurrClass = metaclass(obj);
0037       startApp(obj)
0038     end
0039 
0040     function value = get.AppPath(obj)
0041        appview = com.mathworks.appmanagement.AppManagementViewSilent;
0042        appAPI = com.mathworks.appmanagement.AppManagementApiBuilder.getAppManagementApiCustomView(appview);
0043            
0044        myAppsLocation = char(appAPI.getMyAppsLocation);
0045        
0046        value = cellfun(@(x) fullfile(myAppsLocation, x), obj.AppPath, 'UniformOutput', false);
0047     end
0048 
0049     % Start the application
0050     function startApp(obj)
0051         % Put the application directory on the path
0052         %allpaths = genpath(obj.AppPath{:});
0053         %addpath(strrep(allpaths, [obj.AppPath{:} filesep 'metadata;'], ''));
0054 
0055         % Must load function (force by using function handle) or nargout lies.
0056         % Check if the app is a GUIDE app
0057         if nargout(@gpuBenchApp) == 0  
0058             eval('gpuBenchApp');
0059         else
0060             obj.AppHandle = eval('gpuBenchApp');   
0061         end 
0062         % Increment the reference count by one
0063         GPUBenchApp.refcount(obj.Increment);
0064         if(ishandle(obj.AppHandle))
0065         % Setup cleanup code on figure handle using onCleanup object
0066             cleanupObj = onCleanup(@()appinstall.internal.stopapp([],[],obj));
0067         appdata = getappdata(obj.AppHandle);
0068         appfields = fields(appdata);
0069         found = cellfun(@(x) strcmp(x,'AppCleanupCode'), appfields);
0070         if(~any(found))
0071         setappdata(obj.AppHandle, 'AppCleanupCode', cleanupObj);     
0072         end  
0073         end
0074     end
0075   end
0076 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.