mirror of https://github.com/BOINC/boinc.git
- client: improve error messages when can't copy files
- client: change CUDA detection on Linux and Mac. Look for libcuda.so in /usr/lib/nvidia and /usr/lib64/nvidia. If we find it, assume that libcudart is in the library path. svn path=/trunk/boinc/; revision=15477
This commit is contained in:
parent
ef6ac744bd
commit
3dd69f52cd
|
@ -5138,3 +5138,14 @@ Rom 25 June 2008
|
|||
|
||||
clientgui/
|
||||
BOINCTaskBar.cpp
|
||||
|
||||
David 25 June 2008
|
||||
- client: improve error messages when can't copy files
|
||||
- client: change CUDA detection on Linux and Mac.
|
||||
Look for libcuda.so in /usr/lib/nvidia and /usr/lib64/nvidia.
|
||||
If we find it, assume that libcudart is in the library path.
|
||||
|
||||
client/
|
||||
app_start.C
|
||||
lib/
|
||||
coproc.C
|
||||
|
|
|
@ -265,7 +265,8 @@ static int setup_file(
|
|||
retval = boinc_copy(file_path, link_path);
|
||||
if (retval) {
|
||||
msg_printf(project, MSG_INTERNAL_ERROR,
|
||||
"Can't copy %s to %s", file_path, link_path
|
||||
"Can't copy %s to %s: %s", file_path, link_path,
|
||||
boincerror(retval)
|
||||
);
|
||||
return retval;
|
||||
}
|
||||
|
@ -319,7 +320,8 @@ int ACTIVE_TASK::copy_output_files() {
|
|||
int retval = boinc_rename(slotfile, projfile);
|
||||
if (retval) {
|
||||
msg_printf(wup->project, MSG_INTERNAL_ERROR,
|
||||
"Can't rename output file %s", fip->name
|
||||
"Can't rename output file %s to %s: %s",
|
||||
fip->name, projfile, boincerror(retval)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -737,7 +739,7 @@ int ACTIVE_TASK::start(bool first_time) {
|
|||
dup2(fd, STDOUT_FILENO);
|
||||
close(fd);
|
||||
|
||||
// add project dir to library path
|
||||
// add project dir and slot dir to library path
|
||||
//
|
||||
char libpath[8192];
|
||||
get_project_dir(wup->project, buf, sizeof(buf));
|
||||
|
|
|
@ -59,4 +59,47 @@ function lookup_categorization($name) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function filter_form($sel_name, $sel_cat) {
|
||||
global $categorizations;
|
||||
$checked = (!$sel_name || $sel_name == "none")?"checked":"";
|
||||
echo "
|
||||
Filter by:
|
||||
<ul>
|
||||
<li><input type=radio name=filter value=none $checked> None
|
||||
";
|
||||
foreach ($categorizations as $c) {
|
||||
$name = $c->name();
|
||||
$cats = $c->categories();
|
||||
echo "
|
||||
<li> $name
|
||||
<ul>
|
||||
";
|
||||
foreach ($cats as $x) {
|
||||
$checked = ($sel_name == $name && $sel_cat == $x) ? "checked":"";
|
||||
echo "
|
||||
<li> <input type=radio name=filter value=\"$name:$x\" $checked> $x
|
||||
";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
function breakdown_form($sel_name) {
|
||||
global $categorizations;
|
||||
echo "
|
||||
Break down by:
|
||||
<ul>
|
||||
<li><input type=radio name=breakdown value=none> None
|
||||
";
|
||||
foreach ($categorizations as $c) {
|
||||
$name = $c->name();
|
||||
$checked = ($sel_name == $name)?"checked":"";
|
||||
echo "
|
||||
<li> <input type=radio name=breakdown value=\"$name\" $checked> $name
|
||||
";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -240,4 +240,38 @@ function test_stats() {
|
|||
echo "lo $lo hi $hi\n";
|
||||
}
|
||||
|
||||
//////////// graph drawing
|
||||
|
||||
function bar($title, $n, $width, $lo, $hi) {
|
||||
$x1 = $width*$lo;
|
||||
$x2 = $width*($hi-$lo);
|
||||
$a1 = number_format($lo*100);
|
||||
$a2 = number_format($hi*100);
|
||||
return "
|
||||
<tr>
|
||||
<td>$title<br><span class=note>($n students)</span></td>
|
||||
<td>
|
||||
<table class=bolt_bar width=$width><tr class=bolt_bar>
|
||||
<td class=bolt_bar1 width=$x1 bgcolor=lightgray align=right>$a1</td>
|
||||
<td class=bolt_bar2 width=$x2 bgcolor=black></td>
|
||||
<td class=bolt_bar1 bgcolor=lightgray>$a2</td>
|
||||
</tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
function bar_insuff($title, $width) {
|
||||
return "
|
||||
<tr>
|
||||
<td>$title</td>
|
||||
<td>
|
||||
<table class=bolt_bar width=$width><tr class=bolt_bar>
|
||||
<td class=bolt_bar1 bgcolor=lightgray>Insufficient data</td>
|
||||
</tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -17,51 +17,8 @@ require_once("../inc/bolt_db.inc");
|
|||
require_once("../inc/bolt_util.inc");
|
||||
require_once("../inc/bolt_cat.inc");
|
||||
|
||||
function filter_form($sel_name, $sel_cat) {
|
||||
global $categorizations;
|
||||
$checked = (!$sel_name || $sel_name == "none")?"checked":"";
|
||||
echo "
|
||||
Filter by:
|
||||
<ul>
|
||||
<li><input type=radio name=filter value=none $checked> None
|
||||
";
|
||||
foreach ($categorizations as $c) {
|
||||
$name = $c->name();
|
||||
$cats = $c->categories();
|
||||
echo "
|
||||
<li> $name
|
||||
<ul>
|
||||
";
|
||||
foreach ($cats as $x) {
|
||||
$checked = ($sel_name == $name && $sel_cat == $x) ? "checked":"";
|
||||
echo "
|
||||
<li> <input type=radio name=filter value=\"$name:$x\" $checked> $x
|
||||
";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
function breakdown_form($sel_name) {
|
||||
global $categorizations;
|
||||
echo "
|
||||
Break down by:
|
||||
<ul>
|
||||
<li><input type=radio name=breakdown value=none> None
|
||||
";
|
||||
foreach ($categorizations as $c) {
|
||||
$name = $c->name();
|
||||
$checked = ($sel_name == $name)?"checked":"";
|
||||
echo "
|
||||
<li> <input type=radio name=breakdown value=\"$name\" $checked> $name
|
||||
";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
function compare_case(
|
||||
$select_unit, $snap, $filter, $filter_cat, $breakdown, $breakdown_cat
|
||||
$title, $select_unit, $snap, $filter, $filter_cat, $breakdown, $breakdown_cat
|
||||
) {
|
||||
|
||||
// for each select alternative, build an array of xset scores
|
||||
|
@ -77,27 +34,30 @@ function compare_case(
|
|||
continue;
|
||||
}
|
||||
$z = $x->sf->selected_unit;
|
||||
echo "<br>unit: $z ";
|
||||
$u = $x->sf->selected_unit;
|
||||
$a[$u][] = $x->xr->score;
|
||||
}
|
||||
|
||||
if ($title) {
|
||||
echo "
|
||||
<tr class=bolt_head2><td colspan=2><b>$title</b></td></tr>
|
||||
";
|
||||
}
|
||||
foreach ($select_unit->units as $child) {
|
||||
if (array_key_exists($child->name, $a)) {
|
||||
$scores = $a[$child->name];
|
||||
$n = count($scores);
|
||||
if ($n < 2) {
|
||||
$x = "insufficient data";
|
||||
$x = bar_insuff($child->name, 600);
|
||||
} else {
|
||||
conf_int_90($scores, $lo, $hi);
|
||||
$x = "($lo, $hi) ($n results)";
|
||||
//$x = "($lo, $hi) ($n results)";
|
||||
$x = bar($child->name, $n, 600, $lo, $hi);
|
||||
}
|
||||
} else {
|
||||
$x = "insufficient data";
|
||||
$x = bar_insuff($child->name, 600);
|
||||
}
|
||||
echo "
|
||||
<p>$child->name: $x
|
||||
";
|
||||
echo $x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,18 +90,24 @@ function compare_aux($select_name, $xset_name, $snap) {
|
|||
|
||||
page_head("Unit comparison");
|
||||
echo "
|
||||
The following compares the alternatives of the
|
||||
<b>$select_name</b> select unit
|
||||
with respect to the <b>$xset_name</b> exercise set unit.
|
||||
<link rel=\"stylesheet\" type=\"text/css\" href=\"".URL_BASE."bolt.css\">
|
||||
The following compares the alternatives of
|
||||
<b>$select_name</b> with respect to <b>$xset_name</b>.
|
||||
<p>
|
||||
";
|
||||
|
||||
compare_case($select_unit, $snap, $filter, $filter_cat, null, null);
|
||||
echo "<table class=\"bolt_box\">";
|
||||
if ($breakdown) echo "<tr class=bolt_head1><td colspan=2>Total</td></tr>";
|
||||
|
||||
compare_case(null, $select_unit, $snap, $filter, $filter_cat, null, null);
|
||||
if ($breakdown) {
|
||||
echo "<tr class=bolt_head1><td colspan=2>Breakdown by $breakdown_name</td></tr>";
|
||||
foreach ($breakdown->categories() as $c) {
|
||||
echo "<h3>$c</h3>";
|
||||
compare_case($select_unit, $snap, $filter, $filter_cat, $breakdown, $c);
|
||||
compare_case($c, $select_unit, $snap, $filter, $filter_cat, $breakdown, $c);
|
||||
echo "<p>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
echo "
|
||||
<form action=bolt_compare.php>
|
||||
|
@ -149,7 +115,7 @@ function compare_aux($select_name, $xset_name, $snap) {
|
|||
<input type=hidden name=course_id value=$course_id>
|
||||
<input type=hidden name=select_name value=\"$select_name\">
|
||||
<input type=hidden name=xset_name value=\"$xset_name\">
|
||||
<table><tr><td>
|
||||
<table width=600><tr><td>
|
||||
";
|
||||
filter_form($filter_name, $filter_cat);
|
||||
echo "</td><td>";
|
||||
|
|
48
lib/coproc.C
48
lib/coproc.C
|
@ -30,6 +30,7 @@
|
|||
#endif
|
||||
|
||||
#include "error_numbers.h"
|
||||
#include "filesys.h"
|
||||
#include "parse.h"
|
||||
|
||||
#include "coproc.h"
|
||||
|
@ -100,36 +101,17 @@ char* COPROC_CUDA::get(COPROCS& coprocs) {
|
|||
|
||||
#ifdef _WIN32
|
||||
int retval;
|
||||
int (__stdcall* __cudaGetDeviceCount)( int * );
|
||||
int (__stdcall* __cudaGetDeviceProperties) ( cudaDeviceProp*, int );
|
||||
int (__stdcall* __cudaGetDeviceCount)(int*);
|
||||
int (__stdcall* __cudaGetDeviceProperties)(cudaDeviceProp*, int);
|
||||
int bufsize=256;
|
||||
char buf[256], path[256];
|
||||
#if 0
|
||||
HKEY key;
|
||||
retval = RegOpenKeyEx(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
_T("SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA CUDA"),
|
||||
NULL,
|
||||
KEY_READ,
|
||||
&key
|
||||
);
|
||||
if (retval != ERROR_SUCCESS) {
|
||||
return "Can't find registry key";;
|
||||
}
|
||||
retval = RegQueryValueEx(key, "InstallDir", NULL, NULL, (LPBYTE)buf, (LPDWORD)&bufsize);
|
||||
RegCloseKey(key);
|
||||
if (retval != ERROR_SUCCESS) {
|
||||
return "Can't get registry value";
|
||||
}
|
||||
sprintf(path, "%s\\bin\\cudart.dll", buf);
|
||||
HMODULE cudalib = LoadLibrary(path);
|
||||
#else
|
||||
HMODULE cudalib = LoadLibrary("nvcuda.dll");
|
||||
#endif
|
||||
if (!cudalib) {
|
||||
return "Can't load library nvcuda.dll";
|
||||
}
|
||||
__cudaGetDeviceCount = (int(__stdcall*)(int*)) GetProcAddress(cudalib, "cudaGetDeviceCount");
|
||||
__cudaGetDeviceCount = (int(__stdcall*)(int*)) GetProcAddress(
|
||||
cudalib, "cudaGetDeviceCount"
|
||||
);
|
||||
if(!__cudaGetDeviceCount) {
|
||||
return "Library doesn't have cudaGetDeviceCount()";
|
||||
}
|
||||
|
@ -139,16 +121,18 @@ char* COPROC_CUDA::get(COPROCS& coprocs) {
|
|||
}
|
||||
#else
|
||||
void* cudalib;
|
||||
void (*__cudaGetDeviceCount)( int * );
|
||||
void (*__cudaGetDeviceProperties) ( cudaDeviceProp*, int );
|
||||
void (*__cudaGetDeviceCount)(int*);
|
||||
void (*__cudaGetDeviceProperties)(cudaDeviceProp*, int);
|
||||
|
||||
#ifdef __APPLE__
|
||||
cudalib = dlopen ("/usr/local/cuda/lib/libcudart.dylib", RTLD_NOW );
|
||||
#else
|
||||
cudalib = dlopen ("/usr/local/cuda/lib/libcudart.so", RTLD_NOW );
|
||||
if (!cudalib) {
|
||||
cudalib = dlopen ("libcudart.so", RTLD_NOW );
|
||||
if (!boinc_file_exists("/usr/lib64/nvidia/libcuda.so")
|
||||
&& !boinc_file_exists("/usr/lib/nvidia/libcuda.so")
|
||||
){
|
||||
return "No CUDA driver found";
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
cudalib = dlopen ("libcudart.dylib", RTLD_NOW );
|
||||
#else
|
||||
cudalib = dlopen ("libcudart.so", RTLD_NOW );
|
||||
#endif
|
||||
if (!cudalib) {
|
||||
return "Can't load library libcudart";
|
||||
|
|
Loading…
Reference in New Issue