Display compute method for the current project

This commit is contained in:
Jake Dube
2017-05-07 21:00:20 +02:00
committed by Laurent Clouet
parent 92a0a4938c
commit cb03b58dbc
7 changed files with 34 additions and 2 deletions

View File

@@ -604,6 +604,7 @@ public class Client {
gui.setRenderingProjectName(""); gui.setRenderingProjectName("");
gui.setRemainingTime(""); gui.setRemainingTime("");
gui.setRenderingTime(""); gui.setRenderingTime("");
gui.setComputeMethod("");
if (err != Error.Type.OK) { if (err != Error.Type.OK) {
this.log.error("Client::work problem with runRenderer (ret " + err + ")"); this.log.error("Client::work problem with runRenderer (ret " + err + ")");
return err; return err;

View File

@@ -40,5 +40,7 @@ public interface Gui {
public void setClient(Client cli); public void setClient(Client cli);
public void setComputeMethod(String computeMethod_);
public Client getClient(); public Client getClient();
} }

View File

@@ -230,9 +230,11 @@ public class Job {
String core_script = ""; String core_script = "";
if (getUseGPU() && config.getGPUDevice() != null && config.getComputeMethod() != ComputeType.CPU) { if (getUseGPU() && config.getGPUDevice() != null && config.getComputeMethod() != ComputeType.CPU) {
core_script = "sheepit_set_compute_device(\"CUDA\", \"GPU\", \"" + config.getGPUDevice().getCudaName() + "\")\n"; core_script = "sheepit_set_compute_device(\"CUDA\", \"GPU\", \"" + config.getGPUDevice().getCudaName() + "\")\n";
gui.setComputeMethod("GPU");
} }
else { else {
core_script = "sheepit_set_compute_device(\"NONE\", \"CPU\", \"CPU\")\n"; core_script = "sheepit_set_compute_device(\"NONE\", \"CPU\", \"CPU\")\n";
gui.setComputeMethod("CPU");
} }
core_script += String.format("bpy.context.scene.render.tile_x = %1$d\nbpy.context.scene.render.tile_y = %1$d\n", getTileSize()); core_script += String.format("bpy.context.scene.render.tile_x = %1$d\nbpy.context.scene.render.tile_y = %1$d\n", getTileSize());
File script_file = null; File script_file = null;

View File

@@ -212,6 +212,11 @@ public class GuiSwing extends JFrame implements Gui {
client = cli; client = cli;
} }
@Override
public void setComputeMethod(String computeMethod) {
this.activityWorking.setComputeMethod(computeMethod);
}
public Configuration getConfiguration() { public Configuration getConfiguration() {
return client.getConfiguration(); return client.getConfiguration();
} }

View File

@@ -135,6 +135,11 @@ public class GuiText implements Gui {
client = cli; client = cli;
} }
@Override
public void setComputeMethod(String computeMethod) {
System.out.println("Compute method: " + computeMethod);
}
@Override @Override
public Client getClient() { public Client getClient() {
return client; return client;

View File

@@ -38,6 +38,7 @@ public class GuiTextOneLine implements Gui {
private String creditsEarned; private String creditsEarned;
private int sigIntCount = 0; private int sigIntCount = 0;
private String computeMethod;
private String status; private String status;
private String line; private String line;
@@ -51,6 +52,7 @@ public class GuiTextOneLine implements Gui {
remaining = 0; remaining = 0;
creditsEarned = null; creditsEarned = null;
status = ""; status = "";
computeMethod = "";
line = ""; line = "";
} }
@@ -146,6 +148,11 @@ public class GuiTextOneLine implements Gui {
client = cli; client = cli;
} }
@Override
public void setComputeMethod(String computeMethod_) {
computeMethod = computeMethod_;
}
@Override @Override
public Client getClient() { public Client getClient() {
return client; return client;
@@ -155,7 +162,7 @@ public class GuiTextOneLine implements Gui {
int charToRemove = line.length(); int charToRemove = line.length();
System.out.print("\r"); System.out.print("\r");
line = String.format("Frames rendered: %d remaining: %d Credits earned: %s | %s %s", rendered, remaining, creditsEarned != null ? creditsEarned : "unknown", project, status + (exiting ? " (Exiting after this frame)" : "")); line = String.format("Frames rendered: %d remaining: %d Credits earned: %s | %s using %s %s", rendered, remaining, creditsEarned != null ? creditsEarned : "unknown", project, computeMethod, status + (exiting ? " (Exiting after this frame)" : ""));
System.out.print(line); System.out.print(line);
for (int i = line.length(); i <= charToRemove; i++) { for (int i = line.length(); i <= charToRemove; i++) {
System.out.print(" "); System.out.print(" ");

View File

@@ -67,6 +67,7 @@ public class Working implements Activity {
private JLabel current_project_name_value; private JLabel current_project_name_value;
private JLabel current_project_duration_value; private JLabel current_project_duration_value;
private JLabel currrent_project_progression_value; private JLabel currrent_project_progression_value;
private JLabel current_project_compute_method_value;
private JLabel user_info_points_total_value; private JLabel user_info_points_total_value;
private JLabel waiting_projects_value; private JLabel waiting_projects_value;
private JLabel connected_machines_value; private JLabel connected_machines_value;
@@ -82,6 +83,7 @@ public class Working implements Activity {
current_project_name_value = new JLabel(""); current_project_name_value = new JLabel("");
current_project_duration_value = new JLabel(""); current_project_duration_value = new JLabel("");
currrent_project_progression_value = new JLabel(""); currrent_project_progression_value = new JLabel("");
current_project_compute_method_value = new JLabel("");
user_info_points_total_value = new JLabel(""); user_info_points_total_value = new JLabel("");
waiting_projects_value = new JLabel(""); waiting_projects_value = new JLabel("");
connected_machines_value = new JLabel(""); connected_machines_value = new JLabel("");
@@ -100,6 +102,7 @@ public class Working implements Activity {
JLabel current_project_name = new JLabel("Name: ", JLabel.TRAILING); JLabel current_project_name = new JLabel("Name: ", JLabel.TRAILING);
JLabel current_project_duration = new JLabel("Rendering for: ", JLabel.TRAILING); JLabel current_project_duration = new JLabel("Rendering for: ", JLabel.TRAILING);
JLabel current_project_progression = new JLabel("Remaining: ", JLabel.TRAILING); JLabel current_project_progression = new JLabel("Remaining: ", JLabel.TRAILING);
JLabel current_project_compute_method_label = new JLabel("Compute method: ", JLabel.TRAILING);
current_project_panel.add(current_project_status); current_project_panel.add(current_project_status);
current_project_panel.add(statusContent); current_project_panel.add(statusContent);
@@ -113,6 +116,9 @@ public class Working implements Activity {
current_project_panel.add(current_project_progression); current_project_panel.add(current_project_progression);
current_project_panel.add(currrent_project_progression_value); current_project_panel.add(currrent_project_progression_value);
current_project_panel.add(current_project_compute_method_label);
current_project_panel.add(current_project_compute_method_value);
// user info // user info
JPanel session_info_panel = new JPanel(new SpringLayout()); JPanel session_info_panel = new JPanel(new SpringLayout());
session_info_panel.setBorder(BorderFactory.createTitledBorder("Session infos")); session_info_panel.setBorder(BorderFactory.createTitledBorder("Session infos"));
@@ -205,7 +211,7 @@ public class Working implements Activity {
Spring widthLeftColumn = getBestWidth(current_project_panel, 4, 2); Spring widthLeftColumn = getBestWidth(current_project_panel, 4, 2);
widthLeftColumn = Spring.max(widthLeftColumn, getBestWidth(global_stats_panel, 4, 2)); widthLeftColumn = Spring.max(widthLeftColumn, getBestWidth(global_stats_panel, 4, 2));
widthLeftColumn = Spring.max(widthLeftColumn, getBestWidth(session_info_panel, 3, 2)); widthLeftColumn = Spring.max(widthLeftColumn, getBestWidth(session_info_panel, 3, 2));
alignPanel(current_project_panel, 4, 2, widthLeftColumn); alignPanel(current_project_panel, 5, 2, widthLeftColumn);
alignPanel(global_stats_panel, 4, 2, widthLeftColumn); alignPanel(global_stats_panel, 4, 2, widthLeftColumn);
alignPanel(session_info_panel, 3, 2, widthLeftColumn); alignPanel(session_info_panel, 3, 2, widthLeftColumn);
} }
@@ -226,6 +232,10 @@ public class Working implements Activity {
current_project_duration_value.setText("<html>" + time_ + "</html>"); current_project_duration_value.setText("<html>" + time_ + "</html>");
} }
public void setComputeMethod(String computeMethod_) {
this.current_project_compute_method_value.setText(computeMethod_);
}
public void displayStats(Stats stats) { public void displayStats(Stats stats) {
DecimalFormat df = new DecimalFormat("##,##,##,##,##,##,##0"); DecimalFormat df = new DecimalFormat("##,##,##,##,##,##,##0");
remainingFrameContent.setText(df.format(stats.getRemainingFrame())); remainingFrameContent.setText(df.format(stats.getRemainingFrame()));