当前位置: 首页>>代码示例>>Java>>正文


Java CLPlatform类代码示例

本文整理汇总了Java中com.nativelibs4java.opencl.CLPlatform的典型用法代码示例。如果您正苦于以下问题:Java CLPlatform类的具体用法?Java CLPlatform怎么用?Java CLPlatform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CLPlatform类属于com.nativelibs4java.opencl包,在下文中一共展示了CLPlatform类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPlatforms

import com.nativelibs4java.opencl.CLPlatform; //导入依赖的package包/类
public List<CLPlatform> getPlatforms() {
    CLPlatform[] platforms = JavaCL.listPlatforms();
    boolean hasSharing = false;
    plat: for (CLPlatform platform : platforms)
        if (platform.isGLSharingSupported())
            for (CLDevice device : platform.listAllDevices(false)) 
                if (device.isGLSharingSupported()) {
                    hasSharing = true;
                    break plat;
                }

    configFromGLCheck.setEnabled(hasSharing);
    if (!hasSharing) {
        configFromGLCheck.setText(configFromGLCheck.getText() + " (unavailable option)");
        configFromGLCheck.setToolTipText("Did not find any OpenCL platform with OpenGL sharing support.");
    }
    
    return Arrays.asList(platforms);
}
 
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:20,代码来源:JavaCLSettingsPanel.java

示例2: setDevice

import com.nativelibs4java.opencl.CLPlatform; //导入依赖的package包/类
private void setDevice(CLDevice device) {
    if (device == null) {
        deviceCombo.setSelectedIndex(-1);
        return;
    }

    CLPlatform platform = device.getPlatform();
    if (!platform.equals(platformCombo.getSelectedItem()))
        platformCombo.setSelectedItem(platform);

    for (int i = 0, len = deviceCombo.getModel().getSize(); i < len; i++) {
        CLDevice d = (CLDevice)deviceCombo.getModel().getElementAt(i);
        if (device.equals(d)) {
            deviceCombo.setSelectedItem(d);
            break;
        }
    }
}
 
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:19,代码来源:JavaCLSettingsPanel.java

示例3: getHardwareReportComponent

import com.nativelibs4java.opencl.CLPlatform; //导入依赖的package包/类
public static JComponent getHardwareReportComponent(CLPlatform platform) {
    List<Map<String, Object>> list = listInfos(platform);
    final String html = toHTML(list);

    JEditorPane ed = new JEditorPane();
    ed.setContentType("text/html");
    ed.setText(html);
    ed.setEditable(false);

    JPanel ret = new JPanel(new BorderLayout());
    ret.add("Center", new JScrollPane(ed));

    final String fileName = "HardwareReport.html";
    JButton bWrite = new JButton("Save " + fileName + "...");
    bWrite.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            FileDialog fd = new FileDialog((Frame)null, "Save " + fileName, FileDialog.SAVE);
            fd.setFile(fileName);
            fd.setVisible(true);
            if (fd.getFile() == null)
                return;

            try {
                File file = new File(new File(fd.getDirectory()), fd.getFile());
                file.getParentFile().mkdirs();
                Writer w = new OutputStreamWriter(new FileOutputStream(file), "utf-8");
                w.write(html);
                w.close();

                Platform.show(file);
            } catch (Throwable ex) {
                SetupUtils.exception(ex);
            }
        }

    });

    ret.add("South", bWrite);
    return ret;
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:41,代码来源:HardwareReport.java

示例4: listCompatibleDevices

import com.nativelibs4java.opencl.CLPlatform; //导入依赖的package包/类
@Deprecated
public static List<CLDevice> listCompatibleDevices() {
	List<CLDevice> out = new ArrayList<CLDevice>();
	CLPlatform platforms[] = JavaCL.listPlatforms();
	for (CLPlatform plat : platforms) {
		CLDevice[] devices = plat.listAllDevices(false);
		for (CLDevice dev : devices) {
			if (isDeviceCompatible(dev)) {
				out.add(dev);
			}
		}
	}
	return out;
}
 
开发者ID:apemanzilla,项目名称:JCLMiner,代码行数:15,代码来源:JCLMiner.java

示例5: platformChanged

import com.nativelibs4java.opencl.CLPlatform; //导入依赖的package包/类
private void platformChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_platformChanged
    CLPlatform platform = (CLPlatform)platformCombo.getSelectedItem();
    if (platform != null) {
        CLDevice[] devices = platform.listAllDevices(true);
        deviceCombo.setModel(new DefaultComboBoxModel(devices));
        setDevice(platform.getBestDevice());
    } else {
        deviceCombo.setModel(new DefaultComboBoxModel(new Object[0]));
    }
}
 
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:11,代码来源:JavaCLSettingsPanel.java

示例6: detailsButtActionPerformed

import com.nativelibs4java.opencl.CLPlatform; //导入依赖的package包/类
private void detailsButtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_detailsButtActionPerformed
    CLPlatform platform = (CLPlatform)platformCombo.getSelectedItem();
    if (platform != null) {
        JComponent c = HardwareReport.getHardwareReportComponent(platform);
        c.setMaximumSize(new Dimension(600, 600));
        c.setPreferredSize(new Dimension(600, 600));
        JOptionPane.showMessageDialog(this, c, "HardwareReport for platform '" + platform.getName() + "'", JOptionPane.INFORMATION_MESSAGE);
    }
}
 
开发者ID:nativelibs4java,项目名称:JavaCL,代码行数:10,代码来源:JavaCLSettingsPanel.java

示例7: doExecute

import com.nativelibs4java.opencl.CLPlatform; //导入依赖的package包/类
@Override
protected Object doExecute() throws Exception {
    CLPlatform[] platforms = JavaCL.listGPUPoweredPlatforms();
    System.out.println("#### OpenCL Powered Platforms ####");
    for (int p = 0; p < platforms.length; p++) {
        System.out.println("Platform Name:     " + platforms[p].getName());
        System.out.println("Platform Profile:  " + platforms[p].getProfile());
        System.out.println("Platform Version:  " + platforms[p].getVersion());
        System.out.println("Platform Vendor:   " + platforms[p].getVendor());
        CLDevice[] devices = platforms[p].listAllDevices(true);
        for (int d = 0; d < devices.length; d++) {
            System.out.println("");
            System.out.println("Device Name:            " + devices[d].getName());
            System.out.println("Device Version:         " + devices[d].getOpenCLVersion());
            System.out.println("Device Driver:          " + devices[d].getDriverVersion());
            System.out.println("Device MemCache Line:   " + devices[d].getGlobalMemCachelineSize());
            System.out.println("Device MemCache Size:   " + devices[d].getGlobalMemCacheSize());
            System.out.println("Device LocalMem Size:   " + devices[d].getLocalMemSize());
            System.out.println("Device MaxConBuf Size:  " + devices[d].getMaxConstantBufferSize()); 
            System.out.println("Device Global Mem:      " + devices[d].getGlobalMemSize());
            System.out.println("Device Max Mem Alloc:   " + devices[d].getMaxMemAllocSize());
            System.out.println("Device Clock Speed:     " + devices[d].getMaxClockFrequency());
            System.out.println("Device Compute Units:   " + devices[d].getMaxComputeUnits());
            System.out.println("Device Max Work Items:  " + devices[d].getMaxWorkItemDimensions());
            System.out.println("Device Max Work Groups: " + devices[d].getMaxWorkGroupSize());
            System.out.println("Device Branding:       " + devices[d].toString());
        }
    }
    return null;
}
 
开发者ID:savoirtech,项目名称:HWAAAS,代码行数:31,代码来源:OpenCLInfo.java


注:本文中的com.nativelibs4java.opencl.CLPlatform类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。