Skip to content
This repository
Browse code

gdev: minor fixes

  • Loading branch information...
commit 04dac5189d941035ee6d2fd610c3cc4baae63bd8 1 parent 42c5d76
authored February 01, 2012
6  common/gdev_sched.c
@@ -41,8 +41,11 @@ int gdev_init_scheduler(struct gdev_device *gdev)
41 41
 {
42 42
 	struct gdev_device *phys = gdev->parent;
43 43
 
  44
+	/* create scheduler threads. OS runtime and user-space runtime behave
  45
+	   differently on this function call. */
44 46
 	gdev_sched_create_scheduler(gdev);
45 47
 
  48
+	/* set up virtual GPU schedulers, if required. */
46 49
 	if (phys) {
47 50
 		gdev_lock(&phys->sched_com_lock);
48 51
 		gdev_list_init(&gdev->list_entry_com, (void*)gdev);
@@ -225,6 +228,8 @@ void gdev_schedule_compute(struct gdev_sched_entity *se)
225 228
 		gdev_unlock(&gdev->sched_com_lock);
226 229
 	}
227 230
 
  231
+	/* this function call will block any new contexts to be created during
  232
+	   the busy period on the GPU. */
228 233
 	gdev_access_start(gdev);
229 234
 }
230 235
 
@@ -238,6 +243,7 @@ void gdev_select_next_compute(struct gdev_device *gdev)
238 243
 	struct gdev_device *next;
239 244
 	struct gdev_time now, exec;
240 245
 
  246
+	/* now new contexts are allowed to be created as the GPU is idling. */
241 247
 	gdev_access_end(gdev);
242 248
 
243 249
 	gdev_lock(&gdev->sched_com_lock);
2  common/gdev_sched.h
@@ -56,7 +56,7 @@
56 56
 /**
57 57
  * scheduling properties.
58 58
  */
59  
-#define GDEV_INSTANCES_LIMIT 1
  59
+#define GDEV_INSTANCES_LIMIT 32
60 60
 
61 61
 struct gdev_sched_entity {
62 62
 	struct gdev_device *gdev; /* associated Gdev (virtual) device */
28  test/cuda/common/loop_repeated.c
@@ -92,7 +92,7 @@ int cuda_test_loop_repeated(unsigned int n, int sec, int id, char *path)
92 92
 		return -1;
93 93
 	}
94 94
 
95  
-repeat:
  95
+//repeat:
96 96
 	usleep(100);
97 97
 	res = cuMemcpyHtoD(d_data, data, n * sizeof(unsigned int));
98 98
 	if (res != CUDA_SUCCESS) {
@@ -101,7 +101,7 @@ int cuda_test_loop_repeated(unsigned int n, int sec, int id, char *path)
101 101
 	}
102 102
 
103 103
 	static int counter = 0;
104  
-//repeat:
  104
+repeat:
105 105
 	usleep(100);
106 106
 	counter++;
107 107
 	usleep(10 * (rand() % 10));
@@ -140,12 +140,12 @@ int cuda_test_loop_repeated(unsigned int n, int sec, int id, char *path)
140 140
 	}
141 141
 	cuCtxSynchronize();
142 142
 
143  
-//	gettimeofday(&tv_now, NULL);
144  
-//	tvsub(&tv_now, &tv_start, &tv);
145  
-//	printf("%lu:%lu\n", tv.tv_sec, tv.tv_usec);
146  
-//	if (tv.tv_sec < sec) {
147  
-//		goto repeat;
148  
-//	}
  143
+	gettimeofday(&tv_now, NULL);
  144
+	tvsub(&tv_now, &tv_start, &tv);
  145
+	printf("%lu:%lu\n", tv.tv_sec, tv.tv_usec);
  146
+	if (tv.tv_sec < sec) {
  147
+		goto repeat;
  148
+	}
149 149
 
150 150
 	res = cuMemcpyDtoH(data, d_data, n * sizeof(unsigned int));
151 151
 	if (res != CUDA_SUCCESS) {
@@ -153,12 +153,12 @@ int cuda_test_loop_repeated(unsigned int n, int sec, int id, char *path)
153 153
 		return -1;
154 154
 	}
155 155
 
156  
-	gettimeofday(&tv_now, NULL);
157  
-	tvsub(&tv_now, &tv_start, &tv);
158  
-	printf("%lu:%lu\n", tv.tv_sec, tv.tv_usec);
159  
-	if (tv.tv_sec < sec) {
160  
-		goto repeat;
161  
-	}
  156
+//	gettimeofday(&tv_now, NULL);
  157
+//	tvsub(&tv_now, &tv_start, &tv);
  158
+//	printf("%lu:%lu\n", tv.tv_sec, tv.tv_usec);
  159
+//	if (tv.tv_sec < sec) {
  160
+//		goto repeat;
  161
+//	}
162 162
 
163 163
 	res = cuMemFree(d_data);
164 164
 	if (res != CUDA_SUCCESS) {

0 notes on commit 04dac51

Please sign in to comment.
Something went wrong with that request. Please try again.